Reputation: 16541
Must I define every single spring library one by one in my pom.xml
, or is there somekind of multipack?
I found out that, for example, when I let maven download spring-core, it also downloaded spring-asm.
Are there more such packs or similar shortcuts....?
Upvotes: 4
Views: 740
Reputation: 49085
There is a possible duplicate here: Maven - include all submodules of a pom as dependencies in another module
The short answer is no. The long answer is even if you could it would not be a good idea.
Spring used to offer a bundle groupId=org.springframework artifactId=spring
and groupId=org.springframework artifactId=spring-all
. For various reasons (I can't find the link) Spring decided this was a bad practice and I tend to agree.
The best thing to do is if your really want to include all the spring submodules is to use parent poms and a property to denote the version ... eg:
<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.snaphop</groupId>
<artifactId>snaphop-parent</artifactId>
<version>0.0.53-SNAPSHOT</version>
<name>snaphop-parent</name>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.6</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.version>3.1.0.RELEASE</spring.version>
</properties>
..skip some lines
<dependencyManagement>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
You'll have to read about parent poms here: http://maven.apache.org/guides/introduction/introduction-to-the-pom.html#Project_Inheritance_vs_Project_Aggregation (or just google).
The other option is to make your own dummy project with all spring dependencies and depend on that.
That being said I really recommend you explicitly choose your dependecies as it can really help modularize/decouple/refactor your project in the future.
Upvotes: 5