`
蒋兆欣
  • 浏览: 13953 次
  • 性别: Icon_minigender_1
  • 来自: 徐州
社区版块
存档分类
最新评论

Could not find artifact org.springframework:spring-core:jar:3.1.0.M2 in central

 
阅读更多

在pom.xml中配置了spring的相关依赖包 ,

   </dependency>
.....
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
			<version>${org.springframework.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-aop</artifactId>
			<version>${org.springframework.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>${org.springframework.version}</version>
		</dependency>
.....
  </dependencies>
 

settings.xml中也指定了本地仓库路径(因为这些构建已经存在于)

<localRepository>D:\workapp\apache-maven-3.0.3\repository</localRepository>

运行命令 mvn clean test

报错如下 [ERROR] Failed to execute goal on project com.iteye.zxJiang.spring.beginner: Could not resolve dependencies for project com.iteye.zxJiang.spring.beginner:com.iteye.zxJiang.spring.beginner:war:1.0.0-SNAPSHOT: The following artifacts could not be resolved: org.springframework:spring-core:jar:3.1.0.M2, org.springframework:spring-expression:jar:3.1.0.M2, org.springframework:spring-web:jar:3.1.0.M2, org.springframework:spring-webmvc:jar:3.1.0.M2: Could not find artifact org.springframework:spring-core:jar:3.1.0.M2 in central (http://repo1.maven.org/maven2) -> [Help 1]

 

分析 :从默认的仓库中心下载不了这些jar包 ? 但是我本地仓库明明有的啊 ? 难道它不是先检查本地仓库,找不到的话再去远程的仓库找吗? 我认为可能是它需要先去远程仓库检查jar包是否存在或者jar的更新的情况吧,只是猜测,不想深入了解!

 

解决办法 :在pom.xml指定一个repository(仓库)

   <repositories>
	   <repository>
	        <id>org.springframework.maven.milestone</id>
	        <name>spring-framework-repo</name>
	        <url>http://maven.springframework.org/milestone</url>
	        <layout>default</layout>
	        <snapshots>
	            <enabled>false</enabled>
	        </snapshots>
	        <releases>
	            <enabled>true</enabled>
	        </releases>
	    </repository>
    </repositories>
 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics