Spring artifactDescriptorException

时间:2014-01-15 16:32:55

标签: java spring-mvc maven-2

您好我是Spring的新手,在STS修改自动生成的弹簧mvc项目时,我在标记视图上出现此错误:

    Description Resource    Path    Location    Type
ArtifactDescriptorException: Failed to read artifact descriptor for org.springframework:spring-context:jar:${spring.version}: ArtifactResolutionException: Failure to transfer org.springframework:spring-context:pom:${spring.version} from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.springframework:spring-context:pom:${spring.version} from/to central (http://repo.maven.apache.org/maven2): Illegal character in path at index 72: http://repo.maven.apache.org/maven2/org/springframework/spring-context/${spring.version}/spring-context-${spring.version}.pom    pom.xml /MMASGIS7   line 1  Maven Dependency Problem

你可以在http://pastebin.com/DkKzG2DR看到我的pom.xml 你能解决我正确的方向来解决它吗?

2 个答案:

答案 0 :(得分:2)

maven运行时无法解析依赖关系,因为它无法解析自缺少属性以来指定的版本。 将此属性添加到pom.xml文件或完全删除spring.version并使用您已在pom中定义的org.springframework-version

<spring.version>3.1.1.RELEASE</spring.version>

我建议只使用其中一个来保持一致性和传递依赖性。

答案 1 :(得分:1)

您使用两个属性用于相同目的:即 org.springframework-versionspring.version。只使用其中一个,在pom部分的其余部分中引用相同的部分。

              <properties>
                        <java-version>1.6</java-version>
                        <org.springframework-version>3.1.1.RELEASE</org.springframework-version>
                              or    
                        <spring.version>3.0.5.RELEASE</spring.version>
                        <org.aspectj-version>1.6.10</org.aspectj-version>
                        <org.slf4j-version>1.6.6</org.slf4j-version>                       
                </properties>


Since you have alreay defined `org.springframework-version` , You can replace ${spring.version} by ${org.springframework-version}