Question

Using tar.gz generated using the maven-assembly-plugin contains a few jar files. I would like to copy the tarball, unpack and execute a java program using the jar file(s).

Is there any other plugin to achieve this or should it be done using a build shell script?

Appreciate any help!

Was it helpful?

Solution

It sounds like a series of unix commands you want to execute and it's better to keep them in a script and attach them to a maven lifecycle stage using exec-maven-plugin

<plugin>
  <artifactId>exec-maven-plugin</artifactId>
  <groupId>org.codehaus.mojo</groupId>
  <executions>
    <execution>
      <phase>generate-sources</phase> <!-- if you want to attach it to a phase -->
      <goals>
        <goal>exec</goal>
      </goals>
      <configuration>
        <executable>${basedir}/myScripts/myScript.sh</executable>
      </configuration>
    </execution>
  </executions>
</plugin>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top