Getting all the Maven dependencies and License Information for an artifact

A code snippet showing getting all the Maven dependencies and License Information for an 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>