Maven Include Dependencies in JAR Artifact: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 6: | Line 6: | ||
=Overview= | =Overview= | ||
There are situations when we want to extract some of the dependencies and bundle them with the JAR artifact. This is done using the jar plugin and the dependency plugin together, as described below. | There are situations when we want to extract some of the dependencies and bundle them with the JAR artifact, merged with the artifact classes. This is done using the jar plugin and the dependency plugin together, as described below. | ||
Configure the Maven dependency plugin to unpack dependencies, or just some of them, in the directory that will be archived by the jar plugin: | Configure the Maven dependency plugin to unpack dependencies, or just some of them, in the directory that will be archived by the jar plugin: |
Revision as of 21:46, 24 March 2017
Internal
Overview
There are situations when we want to extract some of the dependencies and bundle them with the JAR artifact, merged with the artifact classes. This is done using the jar plugin and the dependency plugin together, as described below.
Configure the Maven dependency plugin to unpack dependencies, or just some of them, in the directory that will be archived by the jar plugin:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>3.0.0</version> <executions> <execution> <id>unpack-some-dependencies</id> <phase>prepare-package</phase> <goals> <goal>unpack-dependencies</goal> </goals> <configuration> <outputDirectory>${project.build.directory}/classes</outputDirectory> <includes>**/SimpleStateless.class</includes> <overWriteReleases>false</overWriteReleases> <overWriteSnapshots>false</overWriteSnapshots> <overWriteIfNewer>true</overWriteIfNewer> </configuration> </execution> </executions> </plugin>