Skip to content

Instantly share code, notes, and snippets.

@MoriTanosuke
Last active February 9, 2016 21:24
Show Gist options
  • Save MoriTanosuke/b08eba6bf60d0568b522 to your computer and use it in GitHub Desktop.
Save MoriTanosuke/b08eba6bf60d0568b522 to your computer and use it in GitHub Desktop.
Simple POM with override dependencies with pure dependencyManagement

The dependency hamcrest-core is overriden to version 1.2.1 with pure dependencyManagement entry. You don't have to specify a dependency for it.

Run mvn dependency:tree to check.

<?xml version="1.0" ?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.kopis</groupId>
<artifactId>simple-quickstart</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<version>1.3.2.RELEASE</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>7.0.67</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment