Reputation: 433
I have the following Maven project structure:
${basedir}/
- pom.xml
- lib/
- dependency1.jar
- dependency2.jar
- ...
- src/
- main/..
- test/..
- target/
- classes/..
- blah/
- uggh/
How can I modify the pom file in order to include the entire lib folder (with its content) in the generated output jar?
This folder includes third parties jars that can not be part of the Maven repository.
Upvotes: 1
Views: 3392
Reputation: 1
for specifying the exact jar location include the following in your <plugin>
under <build>
:
<configuration>
<outputDirectory>
${project.basedir}/../build/jars
</outputDirectory>
</configuration>
Upvotes: 0
Reputation: 3277
Use maven-jar-plugin
to copy the dependencies from lib into your fat jar
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>your.main.class</mainClass>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
Upvotes: 1