My scenario: I have deployed certain test files onto a server and I want to run a shell script on that remote server using maven. There is no maven plugin for the curent language hence I am doing it this way. The shell script will run the tests and generate an output in a .txt format.
My Problem: I have successfully ran the script using the maven-ant-run plugin BUT it does not show the maven output. After it executes the script, the output when running maven does not show anything after it. So in this case, using maven-ant-run is not ideal. This is part of my POM.xml:
<plugin>
<!-- Step to copy the unit tests to designated destination -->
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>Deploy Unit tests onto Server</id>
<phase>process-test-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<!-- Copy files to the remote integration test server -->
<!-- Transferring unit tests -->
<scp failonerror="true" todir="${scp.user}:${scp.password}@${scp.host}:/${scp.dirCopyToUnit}" trust="true">
<fileset dir="${scp.UnitTest.api.dir}">
<include name="*"></include>
</fileset>
</scp>
<!-- transferring resources files -->
<scp failonerror="true" todir="${scp.user}:${scp.password}@${scp.host}:/${scp.dirCopyToUnitResources}" trust="true">
<fileset dir="${scp.UnitTest.api.dirResources}">
<include name="*"></include>
</fileset>
</scp>
<!-- transferring spec_helper.lua -->
<scp failonerror="true" todir="${scp.user}:${scp.password}@${scp.host}:/${scp.dirCopySpec_Helpers}" trust="true">
<fileset dir="${scp.UnitTest.api.dirSpec_Helpers}">
<include name="*"></include>
</fileset>
</scp>
<sshexec command="sh /tmp/unitTestMaven.sh exit exit" host="${scp.host}" password="${scp.password}" trust="yes" username="${scp.user}"></sshexec>
<taskdef classname="org.apache.tools.ant.taskdefs.optional.ssh.SSHExec" classpathref="maven.plugin.classpath" name="sshexec"></taskdef>
</target>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.53</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-jsch</artifactId>
<version>1.8.4</version>
</dependency>
</dependencies>
</plugin>
Can someone shed some light on this?
Possible resources: maven antrun ssh or scp hides the output
I've also tried using the wagon plugin:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>execute-test-commands</id>
<phase>test</phase>
<goals>
<goal>sshexec</goal>
</goals>
<configuration>
<serverId>atlassian-public</serverId>
<url>"scp://${scp.user}:${scp.password}@${scp.host}"</url>
<commands>
<command>sh /tmp/unitTestMaven.sh</command>
</commands>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
But getting the following error: org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:wagon-maven-plugin:1.0:sshexec (execute-test-commands) on project aa: Unable to create a Wagon instance