I'm trying to migrate a project from Ant over to Maven. While building the application in a jar-file I need to include some 3rd party libraries.
Trying with the following Maven Jar Plugin configuration, but it doesn't work. Only the content within target/classes are includes.
The Ant jar target has an additional configuration that takes any of these 3rd party dependencies and unpack them and include them in the jar file. I need the Maven Jar Plugin to do the same because we bundle these 3rd party libraries within the application (there are only 3 of them).
I tried to use the Maven Dependency plugin to unpack all my dependencies and place them in the target/classes.However this was not included in the jar file. Wonder if the jar file was created before the dependencies where unpacked. Perhaps I need to change to a different phase for this plugin?
Joined: Sep 06, 2009
you shall have to use maven assembly plugin to create runnable jar with dependencies.It takes all the dependencies defined in your pom and then add these in jar file.
I was thinking about the assembly plugin. However, using maven-dependency-plugin along with maven-jar-plugin works fine also.
The dependency plugin is run with the goal unpack-dependencies and all dependencies are unpacked into target/classes. Then the jar plugin makes a runnable jar file from the content within target/classes.