Idea下Maven开发webapp时候,出现无法解析Maven-archetype-plugin情况
来源:互联网 发布:紫鸟数据魔方怎么使用 编辑:程序博客网 时间:2024/05/23 17:56
1.Centos7开发环境下,使用Idea下Maven开发webapp时候,出现无法解析Maven-archetype-plugin情况,控制台出现如下代码。
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.030 s
[INFO] Finished at: 2017-07-07T08:53:53+08:00
[INFO] Final Memory: 7M/106M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-archetype-plugin:RELEASE or one of its
dependencies could not be resolved: Failed to read artifact descriptor for
org.apache.maven.plugins:maven-archetype-plugin:jar:RELEASE: Failed to resolve version for
org.apache.maven.plugins:maven-archetype-plugin:jar:RELEASE: Could not find metadata
org.apache.maven.plugins:maven-archetype-plugin/maven-metadata.xml in local
(/home/cloud/.m2/repository) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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 read the following
articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
[ERROR] Maven execution terminated abnormally (exit code 1)
这个问题浪费了我很长时间,一开始以为是无法加载Maven-archetype-plugin这个插件所导致的,百度谷歌了很多方法,问题依然没有解决(网上解决这个问题的方法主要有两种,一种是修改settings.xml里面的镜像,另一种下载jar包进行替换,参考网址https://www.bbsmax.com/A/pRdBjPnndn/)
当我熟手无措的时候,查看控制台错误提示发现,如下代码
[INFO] Scanning for projects...
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-archetypeplugin/maven-metadata.xml
Jul 07, 2017 8:53:53 AM org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec
execute
INFO: I/O exception (org.apache.maven.wagon.providers.http.httpclient.NoHttpResponseException)
caught when processing request to {tls}->http://202.204.4.17:8118-
>https://repo.maven.apache.org:443: The target server failed to respond
Jul 07, 2017 8:53:53 AM org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec
execute
INFO: Retrying request to {tls}->http://202.204.4.17:8118->https://repo.maven.apache.org:443
Jul 07, 2017 8:53:53 AM org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec
execute
INFO: I/O exception (org.apache.maven.wagon.providers.http.httpclient.NoHttpResponseException)
caught when processing request to {tls}->http://202.204.4.17:8118-
>https://repo.maven.apache.org:443: The target server failed to respond
Jul 07, 2017 8:53:53 AM org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec
execute
INFO: Retrying request to {tls}->http://202.204.4.17:8118->https://repo.maven.apache.org:443
Jul 07, 2017 8:53:53 AM org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec
execute
INFO: I/O exception (org.apache.maven.wagon.providers.http.httpclient.NoHttpResponseException)
caught when processing request to {tls}->http://202.204.4.17:8118-
>https://repo.maven.apache.org:443: The target server failed to respond
Jul 07, 2017 8:53:53 AM org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec
execute
INFO: Retrying request to {tls}->http://202.204.4.17:8118->https://repo.maven.apache.org:443
[WARNING] Could not transfer metadata org.apache.maven.plugins:maven-archetype-plugin/mavenmetadata.xml from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org:443
failed to respond
这里突然想到,这个ip地址是公司的可以翻墙的ip地址,但是一个月前已经不能用了,现在才恍然大悟,原来是Maven的settings.xml配置文件里面的代理设置的ip和端口不能用了。
找到了问题所在,接下来便是解决问题,借用一个可用的代理ip和端口,在setting.xml文件中增加proxy节点,需要注意的是
settings.xml 文件可能存在于.m2路径下,也可能存在$M2_HOME\conf($M2_HOME是maven 的安装
路径)路径下,一般来说,如果.m2 路径下没有settings.xml文件,修改maven 的安装目录下的\conf目录
下 settings.xml 即可,如果失败的话,可以将maven的安装目录下的\conf目录下settings.xml 复制到.m2
路径下。
具体的代理设置如下(在 settings.xml 文件中增加<proxies></proxies>这段内容):
<settings>
...
<proxies>
<proxy>
<id>my-proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>192.168.10.117</host>
<port>3267</port>
<!--
<username>shihuan</username>
<password>123456</password>
<nonProxyHosts>repository.mycom.com|*.google.com</nonProxyHosts>
-->
</proxy>
</proxies>
...
</settings>
即将 <host></host> <port></port>标签代理的ip和端口改成可以连接外网的即可
(转载别人的一段话,关于.m2路径下的settings.xml和Maven安装路径下conf路径下的settings.xml区别
经本人研究 maven的官方说明,得到解决方案如下:将maven的安装目录\conf目录下的 settings.xml拷
贝到 C:\Users\lenevo\.m2 目录下即可。
如果我们修改 maven 的安装目录\conf目录下的settings.xml的 repository 的值,使得新的 jar 不在
C:\Users\lenevo\.m2 中存在而在新的目录中存在,而事实上这却对maven执行时下载 jar 包的位置没有影
响,这就是由于 C:\Users\lenevo\.m2\settings.xml 对maven的影响。由于
C:\Users\lenevo\.m2\settings.xml 文件没有变化,只修改maven的安装目录\conf目录下的settings.xml
也无济于事。 参考 http://blog.csdn.net/evilcry2012/article/details/49802983这个网址 )
- Idea下Maven开发webapp时候,出现无法解析Maven-archetype-plugin情况
- Maven 创建maven-archetype-webapp项目时候缺少maven-archetype-webapp解决办法
- Eclipse下创建maven项目时出现Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:R
- IDEA创建maven-web出现的问题[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3
- idea创建maven-archetype-webapp项目无java目录
- Mac IntelliJ IDEA 创建maven-archetype-webapp超时问题
- idea创建maven-archetype-webapp项目无java目录
- Maven Archetype Plugin
- Maven-archetype和plugin
- Maven Archetype Plugin
- creating maven-archetype-webapp failed
- Maven 2 Archetype Plugin 应用
- Intellij idea maven webapp
- Maven插件之maven-archetype-plugin
- idea Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:
- idea下Maven项目的webapp下的jsp页面无法使用el或者jstl表达式
- 使用Maven archetype-webapp创建web项目
- 在Eclipse中开发Maven-web项目时报错:maven-archetype-webapp
- 接口和实现类???
- 关于redis测试
- Oracle 数据库字段修改删除
- 关于Oracle中的job
- CentOS开机启动
- Idea下Maven开发webapp时候,出现无法解析Maven-archetype-plugin情况
- uboot 顶层Makefile 写全地址
- Open Vswitch 与 网络命名空间
- 开启基于JavaScript的机器学习之路 | 机器学习与JavaScript(一)
- 关于宏的概念,与函数的区别以及优缺点
- 文件处理函数
- 解决Can not perform this action after onSaveInstanceState异常总结
- 4. 什么是应用服务器?
- MTK lcm调试总结及解决思路