Skip to content

Instantly share code, notes, and snippets.

@nipafx
Created April 30, 2020 08:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nipafx/7f56f84b8b6a599a551ac8f28ec0be40 to your computer and use it in GitHub Desktop.
Save nipafx/7f56f84b8b6a599a551ac8f28ec0be40 to your computer and use it in GitHub Desktop.
Configuring Maven's copy-dependencies MOJO
<!-- executed during build -->
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version><!-- currently 3.1.2 --></version>
<executions>
<execution>
<!-- with this ID, the command above picks up the config -->
<id>default-cli</id>
<!-- if `process-sources` doesn't match your needs -->
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<!-- if you prefer a different folder -->
<outputDirectory>dependencies</outputDirectory>
<!-- if you only need direct dependencies -->
<excludeTransitive>true</excludeTransitive>
</configuration>
</execution>
</executions>
</plugin>
<!-- executed with `mvn dependency:copy-dependencies` -->
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.2 <!--update--></version>
<executions>
<execution>
<id>default-cli</id>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>dependencies</outputDirectory>
<prependGroupId>true</prependGroupId>
<overWriteSnapshots>true</overWriteSnapshots>
<excludeTransitive>true</excludeTransitive>
<!--<includeScope>compile</includeScope>-->
<!--<excludeScope>test</excludeScope>-->
<useSubDirectoryPerScope>true</useSubDirectoryPerScope>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment