Skip to content

Instantly share code, notes, and snippets.

@kasimok
Created December 9, 2016 07:45
Show Gist options
  • Save kasimok/85b0e25ae03e29f4118736ef9ec6aadd to your computer and use it in GitHub Desktop.
Save kasimok/85b0e25ae03e29f4118736ef9ec6aadd to your computer and use it in GitHub Desktop.
Maven make runnable Jar and copy depencies
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>Application</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment