When executing a command such as
You may want to include all the dependencies into the jar itself.
You may add this plugin to your pom.xml file in the <project><build><plugins> section (copied from stackoverflow.com).
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
If you do this, the maven-assemply-plugin will execute the jar-with-dependencies during the package phase. You should then see two jars in your Maven repository. One will have a suffix like '-jar-with-dependencies.jar'.
No comments:
Post a Comment