我知道我可能会把不同的版本放在一起,但是我不知道如何弄清楚在哪里。我是maven和spring的新手,这是我遇到的一个常见问题所以你能告诉我这里有什么问题以及如何识别未来不兼容的版本吗? 这是我的pom.xml:
<dependencies>
<dependency>
<groupId>aopalliance</groupId>
<artifactId>aopalliance</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.6</version>
</dependency>
<dependency>
<groupId>org.gatein.common</groupId>
<artifactId>common-logging</artifactId>
<version>2.2.2.Final</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>4.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-asm</artifactId>
<version>3.1.4.RELEASE</version>
</dependency>
<dependency>
<groupId>servletapi</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4-20040521</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>4.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>1.2.6</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>4.0.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>4.0.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>4.0.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>4.2.0.RELEASE</version>
</dependency>
</dependencies>
我在创建项目时遵循不同的教程,因为它们更老,我总是面临依赖性问题 http://www.studytrails.com/frameworks/spring/spring-security-using-xml.jsp
答案 0 :(得分:1)
首先尝试创建属性值(在pom.xml中):
<properties>
<spring.version>4.2.0.RELEASE</spring.version>
</properties>
<!-- both properties as dependencies are directly under `project`!, don't use
`dependencyManagement` until later -->
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
</dependencies>
这使得更容易同时更新所有内容
要查看是否使用了不同的依赖项,请打开pom.xml(在Eclipse中)
点击Dependency Hierarchy
标签(底部)
在这里,您可以看到依赖项之间是否存在conflicts
,以及它们与您的代码以及直接或间接导入的依赖项的层次结构之间的关系。
还有什么帮助,是通过调用来检查您是否已导入最新版本(请参阅https://stackoverflow.com/a/2687228/928952示例)
mvn versions:display-dependency-updates
还有一件事,wrt版本(见version update policy):
7.1 Maven中版本号的工作原理Maven的版本控制方案使用以下标准:
MajorVersion
的限定符
MinorVersion
IncrementalVersion
BuildNumber
示例:
MajorVersion:1.2.1
MinorVersion:2.0
增量版本:1.2-SNAPSHOT
BuildNumber:1.4.2-12
资格赛:1.2-beta-2