1

I am trying to incorporate a shell script in my maven build. This is what I want: Transfer unit tests to a server, run the tests on the server, transfer the output of the tests back to the maven build, maven then parses the test results and continues/fails based on the output. (I know this is a weird way but because there are no testing plugins for the chosen programming language on maven, this is the most efficient way of introducing unit tests).

I have written a shell script on the server, which does run the tests and places the outputs in a /testOutput folder on the server. But I have 2 problems:

How would I be able to run the shell script, located on the server, using maven and how would I be able to run it with sudo?

lualover2017
  • 207
  • 1
  • 6
  • 16
  • See http://stackoverflow.com/questions/3491937/i-want-to-execute-shell-commands-from-mavens-pom-xml – Tunaki Feb 09 '17 at 12:04
  • How would I be able to do it remotely? Also, the answer does not incorporate sudo access – lualover2017 Feb 09 '17 at 12:41
  • Look at the Wagon Plugin then http://www.mojohaus.org/wagon-maven-plugin/usage.html, especially the sshexec goal http://www.mojohaus.org/wagon-maven-plugin/sshexec-mojo.html – Tunaki Feb 09 '17 at 12:45
  • Would I paste the user's password of the server in the serverId parameter? – lualover2017 Feb 09 '17 at 13:02
  • No, `serverId` references the ID of a server configured in the Maven Settings. Look here https://maven.apache.org/settings.html#Servers – Tunaki Feb 09 '17 at 14:45

0 Answers0