Maven编译提示如下错误信息怎么解决?

D:\Java\Hello-world>mvn clean compile
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Hello world Project 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-
clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 44.022s
[INFO] Finished at: Thu Jan 16 15:01:42 CST 2014
[INFO] Final Memory: 2M/127M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.4.1 or one of its d
ependencies could not be resolved: Failed to read artifact descriptor for org.ap
ache.maven.plugins:maven-clean-plugin:jar:2.4.1: Could not transfer artifact org
.apache.maven.plugins:maven-clean-plugin:pom:2.4.1 from/to central (http://repo.
maven.apache.org/maven2): Connection to http://repo.maven.apache.org refused: Co
nnection timed out: connect -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResoluti
onException

6个回答

是不是用代理上网的啊,如果是,在maven目录下找到setting.xml增加代理设置

1.检查pom文件有没有红叉
2.检查连的仓库里是不是有你需要的jar包

Connection to http://repo.maven.apache.org refused: Co
nnection timed out: connect -> 看错误信息可能是网络连接问题,
第一步检查网络连接。

如果网络连接没有问题

第二步:使用mvn clean compile -X 将详细的信息显示出来

针对详细信息在分析原因。

可以参考:

http://stackoverflow.com/questions/16663331/maven-building-error

ps:如有兴趣可以关注一下微信公众账号:ahhqcheng 会定期分享一下编程的问题及解决方法。 :D

运行 mvn clean, 需要 maven-clean-plugin:2.4.1。
你本地没有这个jar,maven就自动到http://repo.maven.apache.org/maven2/... 那里去拿。
你网络又有问题,连不上http://repo.maven.apache.org/maven2/... , Maven就怒了,吐你一串Error。

网络问题,那个主仓库访问慢。
解决办法是访问Maven仓库的国内Mirror吧
http://maven.oschina.net/help.html

http://www.kaifazhe.me/maven/217.html
可以更换下镜像地址.

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问