Skip to content

Instantly share code, notes, and snippets.

@sachin-handiekar
Created June 21, 2015 09:41
Show Gist options
  • Save sachin-handiekar/26cbcf5842eb1c813111 to your computer and use it in GitHub Desktop.
Save sachin-handiekar/26cbcf5842eb1c813111 to your computer and use it in GitHub Desktop.
A Maven pom to fetch all the dependencies for a given Artifact
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.sachinhandiekar</groupId>
<artifactId>MavenDependencyFetcher</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<maven-project-info-reports-plugin.version>2.8</maven-project-info-reports-plugin.version>
<maven-dependency-plugin.version>2.10</maven-dependency-plugin.version>
</properties>
<dependencies>
<!-- List all your dependency here...
for e.g.
<dependency>
<groupId>com.example</groupId>
<artifactId>ArtifactId</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
-->
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>${maven-dependency-plugin.version}</version>
<executions>
<execution>
<id>copy-dependencies</id>
<goals>
<goal>copy-dependencies</goal>
</goals>
<phase>package</phase>
<configuration>
<addParentPoms>true</addParentPoms>
<copyPom>true</copyPom>
<useRepositoryLayout>true</useRepositoryLayout>
</configuration>
</execution>
<execution>
<id>copy-sources</id>
<goals>
<goal>copy-dependencies</goal>
</goals>
<phase>package</phase>
<configuration>
<classifier>sources</classifier>
<useRepositoryLayout>true</useRepositoryLayout>
</configuration>
</execution>
<execution>
<id>copy-javadoc</id>
<goals>
<goal>copy-dependencies</goal>
</goals>
<phase>package</phase>
<configuration>
<classifier>javadoc</classifier>
<useRepositoryLayout>true</useRepositoryLayout>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>${maven-project-info-reports-plugin.version}</version>
<executions>
<execution>
<id>license-report</id>
<goals>
<goal>dependencies</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment