5 分钟内 Maven 无法工作

发布于 2024-11-02 11:49:46 字数 6841 浏览 2 评论 0原文

我已经下载了最新的

maven 3.0.3,java版本“1.6.0_18”。

mvn –版本

Apache Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100)
    Maven home: C:\software\apache-maven-3.0.3
    Java version: 1.5.0_05, vendor: Sun Microsystems Inc.
    Java home: C:\software\jdk1.5.0.15\jre
    Default locale: en_GB, platform encoding: Cp1252
    OS name: "windows xp", version: "5.1", arch: "x86", family: "windows"

我的应用程序位于:C:\Temp\ecm_esv\app\ENT_APP\ESV>。我收到以下错误消息:

C:\Temp\ecm_esv\app\ENT_APP\ESV>mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
[INFO] Scanning for projects...
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-clean-plugin:2.4.1: Plugin org.apache.maven.plugins:maven-clean-plugin:2.4.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.3.1/maven-install-plugin-2.3.1.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-install-plugin:2.3.1: Plugin org.apache.maven.plugins:maven-install-plugin:2.3.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-install-plugin:jar:2.3.1
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-deploy-plugin/2.5/maven-deploy-plugin-2.5.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-deploy-plugin:2.5: Plugin org.apache.maven.plugins:maven-deploy-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-deploy-plugin:jar:2.5
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-site-plugin/2.0.1/maven-site-plugin-2.0.1.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-site-plugin:2.0.1: Plugin org.apache.maven.plugins:maven-site-plugin:2.0.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-site-plugin:jar:2.0.1
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-antrun-plugin/1.3/maven-antrun-plugin-1.3.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-antrun-plugin:1.3: Plugin org.apache.maven.plugins:maven-antrun-plugin:1.3 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-antrun-plugin:jar:1.3
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-assembly-plugin/2.2-beta-5/maven-assembly-plugin-2.2-beta-5.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5: Plugin org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-assembly-plugin:jar:2.2-beta-5
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/2.1/maven-dependency-plugin-2.1.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-dependency-plugin:2.1: Plugin org.apache.maven.plugins:maven-dependency-plugin:2.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-dependency-plugin:jar:2.1
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-release-plugin/2.0/maven-release-plugin-2.0.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-release-plugin:2.0: Plugin org.apache.maven.plugins:maven-release-plugin:2.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-release-plugin:jar:2.0
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-metadata.xml
Downloading: http://repo1.maven.org/maven2/org/codehaus/mojo/maven-metadata.xml
[WARNING] Could not transfer metadata org.apache.maven.plugins/maven-metadata.xml from/to central (http://repo1.maven.org/maven2): Error transferring file: repo1.maven.org
[WARNING] Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to central (http://repo1.maven.org/maven2): Error transferring file: repo1.maven.org
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-metadata.xml
Downloading: http://repo1.maven.org/maven2/org/codehaus/mojo/maven-metadata.xml
[WARNING] Could not transfer metadata org.apache.maven.plugins/maven-metadata.xml from/to central (http://repo1.maven.org/maven2): Error transferring file: repo1.maven.org
[WARNING] Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to central (http://repo1.maven.org/maven2): Error transferring file: repo1.maven.org
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.406s
[INFO] Finished at: Mon Apr 18 15:51:05 CEST 2011
[INFO] Final Memory: 1M/3M
[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'archetype' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Temp\ecm_esv\app\ENT_APP\ESV), central (http://repo1.maven.org/maven2)] -> [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/NoPluginFoundForPrefixException
C:\Temp\ecm_esv\app\ENT_APP\ESV>

C:\software\apache-maven-3.0.3\conf\settings.xml 我在这里启用了代理:

….


<proxies>
    <!-- proxy
     | Specification for one proxy, to be used in connecting to the network.
     |-->
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>      
      <host>www.BT.co.uk</host>
      <port>80</port>
      <nonProxyHosts>localhost|google.com</nonProxyHosts>
    </proxy>

  </proxies>

我在这里面临的问题是什么?为什么不下载?

I have downloaded latest

maven 3.0.3, java version "1.6.0_18".

mvn –version

Apache Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100)
    Maven home: C:\software\apache-maven-3.0.3
    Java version: 1.5.0_05, vendor: Sun Microsystems Inc.
    Java home: C:\software\jdk1.5.0.15\jre
    Default locale: en_GB, platform encoding: Cp1252
    OS name: "windows xp", version: "5.1", arch: "x86", family: "windows"

My application located at: C:\Temp\ecm_esv\app\ENT_APP\ESV>. I am getting following error message:

C:\Temp\ecm_esv\app\ENT_APP\ESV>mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
[INFO] Scanning for projects...
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-clean-plugin:2.4.1: Plugin org.apache.maven.plugins:maven-clean-plugin:2.4.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.3.1/maven-install-plugin-2.3.1.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-install-plugin:2.3.1: Plugin org.apache.maven.plugins:maven-install-plugin:2.3.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-install-plugin:jar:2.3.1
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-deploy-plugin/2.5/maven-deploy-plugin-2.5.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-deploy-plugin:2.5: Plugin org.apache.maven.plugins:maven-deploy-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-deploy-plugin:jar:2.5
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-site-plugin/2.0.1/maven-site-plugin-2.0.1.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-site-plugin:2.0.1: Plugin org.apache.maven.plugins:maven-site-plugin:2.0.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-site-plugin:jar:2.0.1
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-antrun-plugin/1.3/maven-antrun-plugin-1.3.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-antrun-plugin:1.3: Plugin org.apache.maven.plugins:maven-antrun-plugin:1.3 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-antrun-plugin:jar:1.3
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-assembly-plugin/2.2-beta-5/maven-assembly-plugin-2.2-beta-5.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5: Plugin org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-assembly-plugin:jar:2.2-beta-5
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/2.1/maven-dependency-plugin-2.1.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-dependency-plugin:2.1: Plugin org.apache.maven.plugins:maven-dependency-plugin:2.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-dependency-plugin:jar:2.1
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-release-plugin/2.0/maven-release-plugin-2.0.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-release-plugin:2.0: Plugin org.apache.maven.plugins:maven-release-plugin:2.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-release-plugin:jar:2.0
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-metadata.xml
Downloading: http://repo1.maven.org/maven2/org/codehaus/mojo/maven-metadata.xml
[WARNING] Could not transfer metadata org.apache.maven.plugins/maven-metadata.xml from/to central (http://repo1.maven.org/maven2): Error transferring file: repo1.maven.org
[WARNING] Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to central (http://repo1.maven.org/maven2): Error transferring file: repo1.maven.org
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-metadata.xml
Downloading: http://repo1.maven.org/maven2/org/codehaus/mojo/maven-metadata.xml
[WARNING] Could not transfer metadata org.apache.maven.plugins/maven-metadata.xml from/to central (http://repo1.maven.org/maven2): Error transferring file: repo1.maven.org
[WARNING] Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to central (http://repo1.maven.org/maven2): Error transferring file: repo1.maven.org
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.406s
[INFO] Finished at: Mon Apr 18 15:51:05 CEST 2011
[INFO] Final Memory: 1M/3M
[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'archetype' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Temp\ecm_esv\app\ENT_APP\ESV), central (http://repo1.maven.org/maven2)] -> [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/NoPluginFoundForPrefixException
C:\Temp\ecm_esv\app\ENT_APP\ESV>

C:\software\apache-maven-3.0.3\conf\settings.xml
I have enabled proxies here as:

….


<proxies>
    <!-- proxy
     | Specification for one proxy, to be used in connecting to the network.
     |-->
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>      
      <host>www.BT.co.uk</host>
      <port>80</port>
      <nonProxyHosts>localhost|google.com</nonProxyHosts>
    </proxy>

  </proxies>

What is the problem I am facing here? Why it is not downloading?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

半世蒼涼 2024-11-09 11:49:46

找到解决方案:

解决方案#1:

问题出在settings.xml文件中的代理上:

<host>webproxy</host>

要获取主机,请转到IE->工具->连接->LAN设置->高级->http 。

=====

解决方案#2:

如果给出自动配置代理:则

1>打开IE(或任何浏览器)

2>通过IE->工具->internet选项->连接->LAN设置->从浏览器获取url地址获取地址并输入 url 例如:http://autocache.abc.com/ 并输入,将以 .pac 格式下载文件,保存到桌面

3>在文本板中打开 .pac 文件,识别 PROXY:

在您的编辑器中,它将类似于:

   return "PROXY web-proxy.ind.abc.com:8080; PROXY proxy.sgp.abc.com:8080"; 

4>转到 Maven settings.xml 并输入为:

<proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>          
      <host>web-proxy.ind.abc.com</host>
      <port>8080</port>          
</proxy>

5>通过命令提示符运行 mvn:install 或通过 eclipse 运行。

=====

解决方案 #3:

对于任何其他问题,请删除 maven 本地存储库并再次运行 mvn:install

Found solution:

Solution #1:

issue was with proxy in settings.xml file:

<host>webproxy</host>

to get host goto IE->tools->connection->LAN settings->advanced->http.

=====

Solution #2:

if auto configured proxy is given: then

1> open IE(or any browser)

2> get the url address from your browser through IE->Tools->internet option->connections->LAN Settings-> get address and give in url eg: as http://autocache.abc.com/ and enter, a file will be downloaded with .pac format, save to desktop

3> open .pac file in textpad, identify PROXY:

In your editor, it will come something like:

   return "PROXY web-proxy.ind.abc.com:8080; PROXY proxy.sgp.abc.com:8080"; 

4> go to Maven settings.xml and enter as:

<proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>          
      <host>web-proxy.ind.abc.com</host>
      <port>8080</port>          
</proxy>

5> run mvn:install through command prompt or run through eclipse.

=====

Solution #3:

For any other issues delete maven local repository and run mvn:install again.

口干舌燥 2024-11-09 11:49:46

显然这是一个代理问题。使用 VPN 或编辑 settings.xml 中的 procy 设置。
我搜索了很多关于这个错误的信息。最后,我使用VPN(虚拟专用网络)禁用代理并能够使用Maven的cemtral存储库。

Clearly this is an issue of proxy. Either use VPN or edit procy setting in setting.xml.
I searched lot about this error. Finally, I used VPN(Virtual private network ) to disable the proxy and was able to use cemtral repository of Maven.

记忆里有你的影子 2024-11-09 11:49:46

窗口-首选项-Maven-用户设置。检查settings.xml是否存在?如果 eclipse 说“否”,请从您的朋友那里获取 settings.xml 或设置它的路径。

Window-Preferences-Maven-User Settings. Check, does settings.xml exists? if eclipse says no, get settings.xml from you friend or set the path to it.

闻呓 2024-11-09 11:49:46

尝试检查位于以下目录下的 settings.xml 文件中的代理设置:

C:\Users\UserName\.m2

Try checking proxy settings in settings.xml file located under following directory:

C:\Users\UserName\.m2

☆獨立☆ 2024-11-09 11:49:46

我刚刚将“\apache-maven-3.1.1\conf”目录下的setting.xml复制到Windows机器的目录“${user.home}/.m2/)”,并根据以下内容更改所需的代理设置我的网络如下,它对我有用。

<proxy>
  <id>optional</id>
  <active>true</active>
  <protocol>http</protocol>
  <host>www-proxy.xxxx</host>
  <port>8080</port>
</proxy>

谢谢 -
卡姆兰·沙赫扎德

I just copied setting.xml which comes under "\apache-maven-3.1.1\conf" directory, to the directory "${user.home}/.m2/)" of windows machine and change the required proxy setting according to my network as below and it worked for me.

<proxy>
  <id>optional</id>
  <active>true</active>
  <protocol>http</protocol>
  <host>www-proxy.xxxx</host>
  <port>8080</port>
</proxy>

Thanks --
Kamran Shahzad

痴情换悲伤 2024-11-09 11:49:46

我们观察到,当尝试从此 URL 下载 archtype 时,maven 项目创建失败: Maven 存储库 属于 "https" 协议。

因此,上述解决方案 #2 仅在对 settings.xml 进行一些更改后才有效。我必须使用“https”,而不是使用“http”协议

<proxy>
  <id>optional</id>
  <active>true</active>
  <protocol>https</protocol>          
  <host>web-proxy.ind.abc.com</host>
  <port>8080</port>          

希望它能帮助某人。

注意:请确保检查以下互联网设置。

互联网浏览器>互联网选项>连接[TAB]>局域网设置>在代理服务器下选中使用 LAN 代理服务器 >高级>选中“所有协议使用相同的代理服务器”并单击“确定”。

We have observed that the maven project creation fails when it tries to download the archtype from this URL: Maven Repository which falls under "https" protocol.

So solution #2 mentioned above worked only after a little change to the settings.xml. Instead of using "http" protocol I have to use "https"

<proxy>
  <id>optional</id>
  <active>true</active>
  <protocol>https</protocol>          
  <host>web-proxy.ind.abc.com</host>
  <port>8080</port>          

Hope it helps someone.

Note: Make sure that you check the following internet settings.

Internet Explorer > Internet Options > Connections [TAB] > LAN Settings > Under Proxy server check Use proxy server for LAN > Advanced > Check "same proxy server for all protocols" and Click OK.

許願樹丅啲祈禱 2024-11-09 11:49:46

在 settings.xml 中的代理标签下添加以下内容对我有用

<proxy>
  <id>optional</id>
  <active>true</active>
  <protocol>https</protocol>          
  <host>web-proxy.ind.abc.com</host>
  <port>8080</port>  
</proxy>

Adding below under proxy tag in settings.xml worked for me

<proxy>
  <id>optional</id>
  <active>true</active>
  <protocol>https</protocol>          
  <host>web-proxy.ind.abc.com</host>
  <port>8080</port>  
</proxy>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文