您的位置:首页 > 编程语言 > Java开发

Spring Tool Suite首次使用pom.xml出现依赖异常解决办法

2017-02-08 22:43 537 查看
Ecplise 安装 spring-tool-suit

首次使用pom.xml出现依赖错误解决方法

  来自fair-j 转截请注明出处

  首先这个问题会在第一次使用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 , 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 (): No response received
after 60000 pom.xml /gs-rest-service-complete line 1 Maven Dependency Problem

  解决方法其实很简单

  参照这里: s-right-after-creating

  只要在cmd中对出错的项目进行下mvn compile保证成功后 回到IDE中 如果项目还是有X或者感叹号的话

  再在项目上强制update一下就可以了

  如下:

  






  此外使用maven时用默认的仓库速度会过慢 下载很小的jar包都需要很久 推介使用oschina的源

  使用在这里:

  嫌麻烦的话 我这里有一份:

  < 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 , 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="" xmlns:xsi="" xsi:schemaLocation=""> <!--本地仓库的位置 我放在了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>;/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>;/url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots>
</repository> </repositories> <pluginRepositories> <pluginRepository> <id>nexus</id> <name>local private nexus</name> <url>;/url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> </pluginRepositories>
</profile> </profiles> </settings>

如果使用mvn compile 失败请参考:
http://jingyan.baidu.com/article/066074d645db24c3c21cb088.html
亲测,成功!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐