来自fair-jm.iteye.com 转截请注明出处
?
首先这个问题会在第一次使用STS的时候发生
大体是新建一个带有maven支持的工程 或者直接从DashBorad中导入guide的时候
都会出现pom.xml的异常 导致项目不能被编译?
?
会出现很多的依赖错误 我这边就复制了一个 在新建一个JPA项目的时候会出现:
写道
Description Resource Path Location Type
ArtifactDescriptorException: Failed to read artifact descriptor for org.springframework.boot:spring-boot-starter-web:jar:0.5.0.M6: ArtifactResolutionException: Failure to transfer org.springframework.boot:spring-boot-starter-web:pom:0.5.0.M6 from http://repo.spring.io/libs-snapshot was cached in the local repository, resolution will not be reattempted until the update interval of spring-snapshots has elapsed or updates are forced. Original error: Could not transfer artifact org.springframework.boot:spring-boot-starter-web:pom:0.5.0.M6 from/to spring-snapshots (http://repo.spring.io/libs-snapshot): No response received after 60000 pom.xml /gs-rest-service-complete line 1 Maven Dependency Problem
ArtifactDescriptorException: Failed to read artifact descriptor for org.springframework.boot:spring-boot-starter-web:jar:0.5.0.M6: ArtifactResolutionException: Failure to transfer org.springframework.boot:spring-boot-starter-web:pom:0.5.0.M6 from http://repo.spring.io/libs-snapshot was cached in the local repository, resolution will not be reattempted until the update interval of spring-snapshots has elapsed or updates are forced. Original error: Could not transfer artifact org.springframework.boot:spring-boot-starter-web:pom:0.5.0.M6 from/to spring-snapshots (http://repo.spring.io/libs-snapshot): No response received after 60000 pom.xml /gs-rest-service-complete line 1 Maven Dependency Problem
?
解决方法其实很简单
参照这里:?http://stackoverflow.com/questions/14761234/spring-tool-suite-spring-mvc-project-22-problems-right-after-creating
只要在cmd中对出错的项目进行下mvn compile保证成功后 回到IDE中 如果项目还是有X或者感叹号的话
再在项目上强制update一下就可以了
如下:
?
?
?
此外使用maven时用默认的仓库速度会过慢 下载很小的jar包都需要很久 推介使用oschina的源
使用在这里:http://maven.oschina.net/help.html
嫌麻烦的话 我这里有一份:
<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <!--本地仓库的位置 我放在了H盘--> <localRepository>H:\repository\jar</localRepository> <pluginGroups> </pluginGroups> <proxies> </proxies> <servers> </servers> <!--设置oschina的镜像--> <mirrors> <mirror> <id>nexus-osc</id> <mirrorOf>*</mirrorOf> <name>Nexus osc</name> <url>http://maven.oschina.net/content/groups/public/</url> </mirror> </mirrors> <profiles> <profile> <id>jdk-1.4</id> <activation> <jdk>1.4</jdk> </activation> <repositories> <repository> <id>nexus</id> <name>local private nexus</name> <url>http://maven.oschina.net/content/groups/public/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>nexus</id> <name>local private nexus</name> <url>http://maven.oschina.net/content/groups/public/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> </pluginRepositories> </profile> </profiles> </settings>
?