最近刚开始学习maven工具,下载解压完毕,环境变量配置完毕,运行如下命令尝试快速构建一个maven项目:
mvn archetype:generate
结果就有问题:
[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/codehaus/mojo/maven-metadata.xml
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/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: Connection timed out: connect
[WARNING] Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to central (http://repo1.maven.org/maven2): Error transferring file: Connection timed out: connect
Downloading: http://repo1.maven.org/maven2/org/codehaus/mojo/maven-metadata.xml
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/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: Connection timed out: connect
[WARNING] Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to central (http://repo1.maven.org/maven2): Error transferring file: Connection timed out: connect
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3:30.786s
[INFO] Finished at: Sun Jul 08 15:55:29 CST 2012
[INFO] Final Memory: 2M/121M
[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 (D:\project\.mave_repo\repo), 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
这种hello world级别的操作出错,就怀疑是网络问题,于是让其他同事帮我尝试访问http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom地址,发现完全没问题,感觉异常郁闷。后来网上查了一下,发现是因为联通网络下,无法访问maven.org网站。解决此问题理论上有两个办法,一个是在maven的配置文件中设置代理,另一个是在maven的配置文件中设置联通网络下,能够访问的中央仓库的mirrors。因为也不好找稳定的代理,我就在网上搜索了两个可用的mirror站点,配置方式如下:
1、打开maven配置文件(maven安装目录下的conf目录下的settings.xml文件)
2、搜索mirrors关键字,如果注释说明的下方没有 <mirrors>节点,则建立mirrors节点,带mirrors节点的所有配置如下(复制下面的内容,粘贴到配置文件中即可):
<mirrors>
<!-- mirror
| Specifies a repository mirror site to use instead of a given repository. The repository that
| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
|
<mirror>
<id>mirrorId</id>
<mirrorOf>repositoryId</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://my.repository.com/repo/path</url>
</mirror>
-->
<mirror>
<id>ibiblio.org</id>
<name>ibiblio Mirror of http://repo1.maven.org/maven2/</name>
<url>http://mirrors.ibiblio.org/pub/mirrors/maven2</url>
<mirrorOf>central</mirrorOf>
<!-- United States, North Carolina -->
</mirror>
<mirror>
<id>jboss-public-repository-group</id>
<mirrorOf>central</mirrorOf>
<name>JBoss Public Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public</url>
</mirror>
</mirrors>
相关推荐
中央仓库(Central Repository)是Maven的核心组成部分,它是一个全球共享的存储库,包含了海量的开源Java项目构件(如JAR包),开发者可以方便地通过配置Maven来自动下载这些构件,而无需手动搜索并添加到项目中。...
在Android开发过程中,依赖管理是至关重要的,而Maven中央仓库是全球最广泛使用的Java库存储库之一,其中包含了大量Android开发者所需的开源库。本文将详细介绍如何使用名为JarsCrawler的工具,来爬取阿里Maven中央...
阿里云最新的中央仓库地址,原先的不能用了。在这里备份一下。
如果找不到,它会尝试从远程仓库下载,最后是中央仓库,这是所有公共Maven库的全球共享存储库。 ### 本地仓库的位置 默认情况下,Maven的本地仓库位于用户主目录下的`.m2\repository`目录。路径在Windows上通常是`...
主要是基于阿里巴巴云效仓库:...(自2022.12.12起,受 Maven 中央仓库网络限制,阿里云云效 Maven 中央代理仓库可能会出现部分新增依赖查找不到的情况,但不影响已有依赖,请知悉)
maven配置阿里云镜像仓库,maven配置阿里云镜像仓库,maven配置阿里云镜像仓库。
当你在开发过程中引用了一个库,Maven会尝试从中央仓库下载该库到本地仓库,以便后续的编译和构建步骤能够访问到。 本地仓库的路径通常可以在Maven的配置文件`settings.xml`中找到,默认位置在用户的主目录下`.m2\...
maven工程创建时仓库不能自动下载JAR解决办法
nexus 搭建 maven仓库nexus 搭建 maven仓库nexus 搭建 maven仓库nexus 搭建 maven仓库nexus 搭建 maven仓库
【Maven很Maven仓库】这个标题暗示了讨论的核心是关于Maven以及它与Maven仓库的关系。Maven是一个在Java开发中广泛使用的项目管理和综合工具,它通过一个声明式的配置来管理项目的构建、报告和文档。Maven仓库则是...
2. **性能考虑**:虽然多个本地仓库可以解决特定场景下的问题,但也可能会增加系统的复杂性和维护成本。因此,在决定使用多个本地仓库之前,请充分评估其必要性。 3. **安全性**:考虑到数据安全性和完整性,建议...
Sonatype Nexus是官方的Maven中央仓库,包含了大量的开源项目和库。在这里,你可以输入关键字,如库的名称或者作者,来搜索你需要的依赖。搜索结果会显示groupId、artifactId、version以及相关文档链接,方便你复制...
4. **远程仓库**:除了中央仓库之外的其他网络仓库,可以是私有的Nexus或Artifactory等。 ### 配置多仓库 #### 1. pom.xml配置 在`pom.xml`文件中,我们可以在`<repositories>`标签内添加远程仓库配置。这种方式...
如果没有,Maven会尝试从中央仓库或其他配置的远程仓库下载。这极大地提高了开发效率,因为大多数常用的库都会被缓存到本地仓库,避免了网络延迟问题。 本地仓库的位置默认是在用户的家目录下,Windows系统通常是`%...
maven仓库清理命令
maven本地仓库的jar是怎样下载的,maven项目中的jar引用过程,本地仓库,中央仓库,远程仓库的区别理解,镜像配置的理解,标签的作用.
这篇文章详细介绍了 IDEA最新版2020.1的maven工程本地依赖仓库无法使用问题的解决方法,并提供了示例代码,帮助读者快速解决这个问题。 知识点一:IDEA最新版2020.1的maven工程本地依赖仓库无法使用问题的原因 ...
主要介绍了详解maven中央仓库连不上的解决办法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
Maven仓库分为本地仓库、远程仓库和中央仓库。本地仓库是每个开发者机器上默认创建的,用于存储已下载的依赖;远程仓库可以是公司内部的私有仓库或公开的第三方仓库;中央仓库是最主要的公共仓库,由Sonatype维护,...
2. **配置Maven中央仓库** - 如果希望Maven从远程仓库下载依赖,可以在`settings.xml`文件中配置中央仓库。例如使用阿里云的Maven镜像库: ```xml <id>alimaven <mirrorOf>central <name>aliyunmaven ...