我有一个maven项目,我只是更改了我的spring-data-neo4j依赖版本。
它包括:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>1.12.0.RELEASE</version>
</dependency>和
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j</artifactId>
<version>5.0.0.RELEASE</version>
</dependency>以前是
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j</artifactId>
<version>4.1.3.RELEASE</version>
</dependency>所以,我得到了一个错误:
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.4.1.RELEASE:run (default-cli) on project myproject: An exception occurred while running. null: InvocationTargetException: org.springframework.data.repository.config.RepositoryConfigurationSource.getAttribute(Ljava/lang/String;)Ljava/util/Optional; -> [Help 1]这是因为(我认为)我的2个依赖项具有相同的groupId,但不要从同一版本的组中提取。
问题
如何知道应该使用哪个版本的spring-data-commons来匹配5.0.0版本的spring-data-neo4j
更新
我解决了我的问题,只是尝试了大量的版本,直到错误消失。这并不是真正的答案,但我的问题现在消失了。
发布于 2017-10-05 15:37:21
问题在于将Spring-Data-Commons1.12.0单独定义为pom.xml中的依赖项。
只定义spring-data-新4j 5.0.0. because将为您提供spring commons的归属版本,即2.0.0.RELEASE,但如果您还分别定义旧的spring-data-data- 1.12.0.RELEASE,那么它将覆盖较新的传递依赖版本,并导致所经历的问题;可能是因为较新版本的neo4j将尝试使用在1.12.0.RELEASE和2.0.0.RELEASE之间更改的spring-data-commons。
请参阅mvn dependency:tree打印文件的相关部分
定义spring-数据-仅限Defining
[INFO] +- org.springframework.data:spring-data-neo4j:jar:5.0.0.RELEASE:compile
[INFO] +- org.springframework.data:spring-data-commons:jar:2.0.0.RELEASE:compile定义弹簧-数据-新4j 5.0.0 Defining和也是spring-数据-共用1.12.0
[INFO] +- org.springframework.data:spring-data-commons:jar:1.12.0.RELEASE:compile
[INFO] +- org.springframework.data:spring-data-neo4j:jar:5.0.0.RELEASE:compile
(...no transitive spring-data-commons:jar here)https://stackoverflow.com/questions/46587477
复制相似问题