有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

仅在本地获取旧引用的java代码

因此,我目前正在从事一个使用Maven的项目

我在最新版本上添加了一个spring上下文依赖项,并确保从其他依赖项中排除任何旧的spring引用

看起来代码仍然在使用一个旧的引用(尽管由于排除了旧版本的spring,它不再附加源代码)

这个问题只发生在我的本地机器上,因为项目中的其他人下载了完全相同的代码,但没有得到这个StrageBean引用错误

这是pom。xml(我删除了内部项目名称)

我试过运行mvn clean install,用dependency:tree检查依赖项,但没有任何东西可以解决这个问题

<?xml version="1.0"?>

-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>---</groupId>
<artifactId>project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Project</name>

-<build>
<sourceDirectory>src</sourceDirectory>
-<plugins>
-<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
-<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>


-<dependencies>
<!-- dependencies -->
-<dependency>
<groupId>---</groupId>
<artifactId>model</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>

-<dependency>
<groupId>---</groupId>
<artifactId>general.dao</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>

-<dependency>
<groupId>---</groupId>
<artifactId>ExternalJavaConfig</artifactId>
<version>1.0.9-RELEASE</version>
-<exclusions>
-<exclusion>
groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
</exclusion>
</exclusions>
</dependency>

-<dependency>
<groupId>---</groupId>
<artifactId>db</artifactId>
<version>0.0.2-SNAPSHOT</version>
</dependency>

-<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>

-<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.2.6.RELEASE</version>
</dependency>

-<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.2.6.RELEASE</version>
</dependency>

-<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>5.2.6.RELEASE</version>
</dependency>

-<dependency>
<groupId>---</groupId>
<artifactId>---</artifactId>
<version>0.0.3-SNAPSHOT</version>
</dependency>

<!-- External dependencies -->

-<dependency>
<groupId>commons-dbutils</groupId>
<artifactId>commons-dbutils</artifactId>
<version>1.6</version>
</dependency>

-<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>

-<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.3</version>
</dependency>

-<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>2.2.7.RELEASE</version>
</dependency>

-<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>2.2.7.RELEASE</version>
</dependency>

-<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa</artifactId>
<version>2.7.1</version>
</dependency>

-<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.9.1</version>
</dependency>

<!-- External dependencies in internal repo-->

-<dependency>
<groupId>com.ibm.db2</groupId>
<artifactId>db2jcc4</artifactId>
<version>11.1.0.0</version>
</dependency>

-<dependency>
<groupId>---</groupId>
<artifactId>---</artifactId>
<version>5.0.0.34</version>
</dependency>

-<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-instrument</artifactId>
<version>5.2.6.RELEASE</version>
</dependency>

-<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>5.2.6.RELEASE</version>
</dependency>
</dependencies>
</project>```

共 (2) 个答案

  1. # 1 楼答案

    不知何故,代码与其他依赖项发生了冲突。在我只下载了那些特定的之后,它就停止了冲突

  2. # 2 楼答案

    如果问题只出现在您的计算机上,请删除本地存储库(通常位于.m2/repository下的用户目录中),然后重试