Download each Spring library with maven

Should I define each individual spring library one by one in my pom.xml , or are there some of them?

I found out that, for example, when I allowed maven spring -core to load, it also loaded spring -asm.

Are there any other packages or similar shortcuts ...?

+4
source share
1 answer

Here you can find a duplicate: Maven - enable all pom submodules depending on another module

The short answer is no. The answer is long, even if you could it would not be a good idea.

Spring is used to create the package groupId=org.springframework artifactId=spring and groupId=org.springframework artifactId=spring-all . For various reasons (I can't find the link) Spring decided it was bad practice and I tend to agree.

The best thing to do if you really want to include all of the Spring submodules in order to use the parent pumps and property to indicate version ... for example:

 <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> 

Here you should read about parent pumps: http://maven.apache.org/guides/introduction/introduction-to-the-pom.html#Project_Inheritance_vs_Project_Aggregation (or just Google).

Another option is to create your own dummy project with all the Spring dependencies and depend on it.

At the same time, I strongly recommend that you explicitly choose your dependencies, as this can really help in the future modulate / decouple / reorganize your project.

+5
source

Source: https://habr.com/ru/post/1432973/


All Articles