Maven dependency Plugin: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 46: Line 46:


{{Internal|Maven Include Dependencies in JAR Artifact|Include Dependencies in JAR Artifact}}
{{Internal|Maven Include Dependencies in JAR Artifact|Include Dependencies in JAR Artifact}}
=Download Sources with the Class JAR Files=
{{Internal|Maven Download Sources with the Class JAR Files|Download Sources with the Class JAR Files}}

Revision as of 22:07, 9 January 2018

External

Internal

Operations

List

mvn dependency:resolve

Tree

mvn dependency:tree

Build Classpath

This is a goal that can be used to build a complete dependency classpath (less the artifact itself), as required by the Maven project artifact to function. The classpath is generated in the format to be used in java -cp. It proved useful in wrapper scripts, where it eliminates the need to manually specify the classpath.

Note that the artifact itself is not present on the classpath. If needed, it has to be added independently.

mvn dependency:build-classpath 

More details:

http://maven.apache.org/plugins/maven-dependency-plugin/build-classpath-mojo.html

Analyze

Optimize dependencies with

mvn dependency:analyze

Include Dependencies - or Some of the Dependencies - in JAR

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 here:

Include Dependencies in JAR Artifact

Download Sources with the Class JAR Files

Download Sources with the Class JAR Files