Maven Dependencies

by Wolfram Saringer  (2014-02-10)
last change: 2014-02-10


Using Maven to download dependencies when a project offers no direct downloads:

1. In an empty directory create a pom.xml outlining the dependencies to download, e.g.:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<packaging>war</packaging>
<name>Download</name>
<groupId>at.compass</groupId>
<artifactId>Download</artifactId>
<version>1.0.0</version>
<description>Download Maven dependencies</description>
<dependencies>
<dependency>
<groupId>com.sparkjava</groupId>
<artifactId>spark-core</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
</project>

2. Use Maven to download the JARs including transitive dependencies:
mvn dependency:copy-dependencies

This will put the JARs into the subdirectory target/dependencies


all articles represent the sole opinion of their respective author. all content comes without any warranty for correctnes, despite due diligence.