I am trying to use Maven to create a jar executable that includes dependencies in a separate directory. I have asked many times about the creation of "uberjar" - I do not want this. I want the files to be copied to the "lib" directory, for example (and the jar file MANIFEST.MF with the ClassPath tag that points to them):
/myApp myApp.SNAPSHOT-1.0.jar /lib hibernate.jar log4j.jar ...
As an added bonus, it would be nice if I could copy /src/main/resources/* to /myApp/conf , and then /myApp up the entire /myApp on myApp.zip .
EDIT: I am using the maven-dependency plugin and the maven-resources plugin and the maven-jar plugin. This is what I include in my pom.xml (which copies the runtime dependencies of / target / release / lib so that I can pin / target / release and it is ready to go):
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>copy-dependencies</id> <phase>package</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <includeScope>runtime</includeScope> <outputDirectory> ${project.build.directory}/release/lib </outputDirectory> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <executions> <execution> <id>copy-resources</id> <phase>package</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${project.build.directory}/release</outputDirectory> <resources> <resource> <directory>src/main/config</directory> <filtering>true</filtering> </resource> </resources> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <executions> <execution> <phase>package</phase> <goals> <goal>jar</goal> </goals> <configuration> <outputDirectory> ${project.build.directory}/release/lib </outputDirectory> </configuration> </execution> </executions> </plugin>
source share