插件 org.apache.maven.plugins:maven-clean-plugin:2.5 或其依赖项之一无法解析
Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved
我已经在我的机器上安装了maven。我已经正确设置了 class-path 和 maven 主文件夹。每次我执行 mvn clean install
,它都会给我异常。我也试过删除 .m2 文件夹,但结果相同。
mvn -version 输出
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T19:57:37+08:00)
Maven home: C:\maven-3
Java version: 1.7.0_45, vendor: Oracle Corporation
Java home: D:\jdk170_45\jre
Default locale: en_US, platform encoding: MS950
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
log for mvn -X clean install
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T19:57:37+08:00)
Maven home: C:\maven-3
Java version: 1.7.0_45, vendor: Oracle Corporation
Java home: D:\jdk170_45\jre
Default locale: en_US, platform encoding: MS950
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
[DEBUG] Created new class realm maven.api
[DEBUG] Importing foreign packages into class realm maven.api
[DEBUG] Imported: javax.enterprise.inject.* < plexus.core
[DEBUG] Imported: javax.enterprise.util.* < plexus.core
[DEBUG] Imported: javax.inject.* < plexus.core
[DEBUG] Imported: org.apache.maven.* < plexus.core
[DEBUG] Imported: org.apache.maven.artifact < plexus.core
[DEBUG] Imported: org.apache.maven.classrealm < plexus.core
[DEBUG] Imported: org.apache.maven.cli < plexus.core
[DEBUG] Imported: org.apache.maven.configuration < plexus.core
[DEBUG] Imported: org.apache.maven.exception < plexus.core
[DEBUG] Imported: org.apache.maven.execution < plexus.core
[DEBUG] Imported: org.apache.maven.execution.scope < plexus.core
[DEBUG] Imported: org.apache.maven.lifecycle < plexus.core
[DEBUG] Imported: org.apache.maven.model < plexus.core
[DEBUG] Imported: org.apache.maven.monitor < plexus.core
[DEBUG] Imported: org.apache.maven.plugin < plexus.core
[DEBUG] Imported: org.apache.maven.profiles < plexus.core
[DEBUG] Imported: org.apache.maven.project < plexus.core
[DEBUG] Imported: org.apache.maven.reporting < plexus.core
[DEBUG] Imported: org.apache.maven.repository < plexus.core
[DEBUG] Imported: org.apache.maven.rtinfo < plexus.core
[DEBUG] Imported: org.apache.maven.settings < plexus.core
[DEBUG] Imported: org.apache.maven.toolchain < plexus.core
[DEBUG] Imported: org.apache.maven.usability < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.* < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.authentication < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.authorization < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.events < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.observers < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.proxy < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.repository < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.resource < plexus.core
[DEBUG] Imported: org.codehaus.classworlds < plexus.core
[DEBUG] Imported: org.codehaus.plexus.* < plexus.core
[DEBUG] Imported: org.codehaus.plexus.classworlds < plexus.core
[DEBUG] Imported: org.codehaus.plexus.component < plexus.core
[DEBUG] Imported: org.codehaus.plexus.configuration < plexus.core
[DEBUG] Imported: org.codehaus.plexus.container < plexus.core
[DEBUG] Imported: org.codehaus.plexus.context < plexus.core
[DEBUG] Imported: org.codehaus.plexus.lifecycle < plexus.core
[DEBUG] Imported: org.codehaus.plexus.logging < plexus.core
[DEBUG] Imported: org.codehaus.plexus.personality < plexus.core
[DEBUG] Imported: org.codehaus.plexus.util.xml.Xpp3Dom < plexus.core
[DEBUG] Imported: org.codehaus.plexus.util.xml.pull.XmlPullParser < plexus.core
[DEBUG] Imported: org.codehaus.plexus.util.xml.pull.XmlPullParserException < plexus.core
[DEBUG] Imported: org.codehaus.plexus.util.xml.pull.XmlSerializer < plexus.core
[DEBUG] Imported: org.eclipse.aether.* < plexus.core
[DEBUG] Imported: org.eclipse.aether.artifact < plexus.core
[DEBUG] Imported: org.eclipse.aether.collection < plexus.core
[DEBUG] Imported: org.eclipse.aether.deployment < plexus.core
[DEBUG] Imported: org.eclipse.aether.graph < plexus.core
[DEBUG] Imported: org.eclipse.aether.impl < plexus.core
[DEBUG] Imported: org.eclipse.aether.installation < plexus.core
[DEBUG] Imported: org.eclipse.aether.internal.impl < plexus.core
[DEBUG] Imported: org.eclipse.aether.metadata < plexus.core
[DEBUG] Imported: org.eclipse.aether.repository < plexus.core
[DEBUG] Imported: org.eclipse.aether.resolution < plexus.core
[DEBUG] Imported: org.eclipse.aether.spi < plexus.core
[DEBUG] Imported: org.eclipse.aether.transfer < plexus.core
[DEBUG] Imported: org.eclipse.aether.version < plexus.core
[DEBUG] Imported: org.slf4j.* < plexus.core
[DEBUG] Imported: org.slf4j.spi.* < plexus.core
[DEBUG] Populating class realm maven.api
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from C:\maven-3\conf\settings.xml
[DEBUG] Reading user settings from C:\Users\H1514\.m2\settings.xml
[DEBUG] Reading global toolchains from C:\maven-3\conf\toolchains.xml
[DEBUG] Reading user toolchains from C:\Users\H1514\.m2\toolchains.xml
[DEBUG] Using local repository at C:\Users\H1514\.m2\repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for C:\Users\H1514\.m2\repository
[INFO] Scanning for projects...
[DEBUG] Extension realms for project camel:camel:jar:0.0.1-SNAPSHOT: (none)
[DEBUG] Looking up lifecyle mappings for packaging jar from ClassRealm[plexus.core, parent: null]
[DEBUG] === REACTOR BUILD PLAN ================================================
[DEBUG] Project: camel:camel:jar:0.0.1-SNAPSHOT
[DEBUG] Tasks: [clean, install]
[DEBUG] Style: Regular
[DEBUG] =======================================================================
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building camel 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://repo.maven.apache.org/maven2
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://repo.maven.apache.org/maven2
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
[DEBUG] Writing tracking file C:\Users\H1514\.m2\repository\org\apache\maven\plugins\maven-clean-plugin.5\maven-clean-plugin-2.5.pom.lastUpdated
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 22.858 s
[INFO] Finished at: 2015-05-29T14:11:00+08:00
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/23.235.47.215] failed: Connection timed out: connect -> [Help 1]
org.apache.maven.plugin.PluginResolutionException: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5
at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:117)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor(DefaultMavenPluginManager.java:179)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor(DefaultMavenPluginManager.java:298)
at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(DefaultBuildPluginManager.java:241)
at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecution(DefaultLifecycleExecutionPlanCalculator.java:169)
at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecutions(DefaultLifecycleExecutionPlanCalculator.java:155)
at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:131)
at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:145)
at org.apache.maven.lifecycle.internal.builder.BuilderCommon.resolveBuildPlan(BuilderCommon.java:96)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:109)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:302)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:218)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:287)
at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:103)
... 26 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/23.235.47.215] failed: Connection timed out: connect
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:287)
... 29 more
Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/23.235.47.215] failed: Connection timed out: connect
at org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed(ArtifactTransportListener.java:43)
at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:355)
at org.eclipse.aether.util.concurrency.RunnableErrorForwarder.run(RunnableErrorForwarder.java:67)
at org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute(BasicRepositoryConnector.java:581)
at org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:249)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:520)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421)
... 32 more
Caused by: org.apache.maven.wagon.TransferFailedException: Connect to repo.maven.apache.org:443 [repo.maven.apache.org/23.235.47.215] failed: Connection timed out: connect
at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:1066)
at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:960)
at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116)
at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
at org.eclipse.aether.transport.wagon.WagonTransporter$GetTaskRunner.run(WagonTransporter.java:560)
at org.eclipse.aether.transport.wagon.WagonTransporter.execute(WagonTransporter.java:427)
at org.eclipse.aether.transport.wagon.WagonTransporter.get(WagonTransporter.java:404)
at org.eclipse.aether.connector.basic.BasicRepositoryConnector$GetTaskRunner.runTask(BasicRepositoryConnector.java:447)
at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:350)
... 37 more
Caused by: org.apache.maven.wagon.providers.http.httpclient.conn.HttpHostConnectException: Connect to repo.maven.apache.org:443 [repo.maven.apache.org/23.235.47.215] failed: Connection timed out: connect
at org.apache.maven.wagon.providers.http.httpclient.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:140)
at org.apache.maven.wagon.providers.http.httpclient.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:318)
at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:363)
at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.MainClientExec.execute(MainClientExec.java:219)
at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec.execute(RetryExec.java:86)
at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
at org.apache.maven.wagon.providers.http.httpclient.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.maven.wagon.providers.http.httpclient.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.execute(AbstractHttpClientWagon.java:832)
at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:983)
... 46 more
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at org.apache.maven.wagon.providers.http.httpclient.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:239)
at org.apache.maven.wagon.providers.http.httpclient.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:123)
... 56 more
[ERROR]
[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
您的调试输出表明 Clean 是它尝试的第一件事 运行,所以我猜它无法从 central 下载任何插件。
首先,看看您是否可以直接在网络浏览器中下载插件 jar:http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.jar
如果可行,那么您的 Web 浏览器可以连接到 Central,但 Maven 不能。这向我表明您的网络浏览器正在使用 Maven 未配置使用的代理。
对 Maven 代理设置进行了深入描述 here。为了简化一点填写(用您的互联网设置中的值替换 protocol/host/port)并将其放入 Maven settings.xml
文件的 <settings>
标记中:
<proxies>
<proxy>
<id>proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxy.example.com</host>
<port>8080</port>
</proxy>
</proxies>
我遇到了同样的问题,但通过 setting.xml(.*\apache-maven-3.3.3\apache-maven-3.3.3\conf)
中的一些更改解决了。
<proxies>
<proxy>
<id>proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>HOSTNAME</host>
<port>PORT</port>
</proxy>
</proxies>
只需在 IE 设置 -> 连接 -> LAN 设置 -> 代理服务器中检查主机名和端口
希望这也能解决您的问题:)
我遇到了同样的问题,即使我正在使用我的家庭 wifi 连接,没有任何代理要求。
我的项目创建于 c:\users\<>\Workspace\Project\
当我去上面的位置和运行
mvn clean install
我遇到以下错误:
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its de
endencies could not be resolved: Failed to read artifact descriptor for org.apa
he.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer artifact org.ap
che.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (https://repo.mave
.apache.org/maven2)
我花了一整天的时间来尝试各种方法来破解这个问题,但就我而言,解决方案非常简单。
我将我的项目移动到非用户特定位置,在 E:\Workspace\Project\
这对我来说太神奇了!
可能是您忘记指定设置,我就是这样。
尝试:
mvn clean install -s settings_file.xml
我遇到了同样的问题,看到我尝试过的所有选项并且 none 都有效,我感到很沮丧,
一旦您正确配置了所有内容,包括 settings.xml
只需清除本地存储库文件夹并尝试 mvn 命令。这对我帮助很大
希望这对其他人有帮助
由于无法访问maven官方仓库导致的错误。此存储库 (https://repo.maven.apache.org/maven2/) 不可访问,因此请按照以下步骤操作:
- 首先删除你的/home/user/.m2文件夹
- 在用户主目录中创建 .m2 文件夹,并在 .m2[= 中创建 repository 文件夹33=]
- 将默认 settings.xml 复制到 .m2 文件夹
- 在settings.xml如下快照中更改镜像如下
mirror_settings
<mirrors>
<mirror>
<id>UK</id>
<name>UK Central</name>
<url>http://uk.maven.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
- 现在执行 mvn clean 命令.....
我遇到了类似的问题。尝试按照以下步骤操作:
手动删除 .m2 文件夹。
请参阅 settings.xml 文件并检查存储库详细信息是否正确,例如 id 和 url 标签。
还要确保您连接到同一网络并检查 URL 是否可以从浏览器访问。
最后将 Maven 项目保存在 /home/User/.
问题可能是 JVM 客户端不信任 repo.maven.apache.org 证书。
根据建议,您可以尝试在浏览器中访问 https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom。
如果可行 - 可能就是这种情况。
您必须明确告诉 JMV 信任 Maven 证书。
可以参考这里的回答"PKIX path building failed" and "unable to find valid certification path to requested target"
我 Mac OS,证书文件位于 /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/security
并且您需要的证书是当您输入上面提到的 URL
时呈现给浏览器的证书
我通过从 open jdk 8.
切换到 oracle jdk 解决了这个问题
$ java -版本
java 版本“1.8.0_221”
Java(TM) SE 运行时环境(build 1.8.0_221-b11)
Java HotSpot(TM) 64 位服务器 VM(内部版本 25.221-b11,混合模式)
参考 Deepak Vishwakarma 的回答,我试过了,但遇到了与 url 相同的问题-问题。我安装了 maven-3.6.3
并在 .m2
文件夹中找到了一个
settings.xml.bak
文件并从中复制了那个镜像 link 并且只是更改了 url @Deepak 所做的。它像魅力一样工作!
镜像 link 我从那个 .bak 文件
http://local.maven.repo:9081/nexus/content/groups/public
然后执行:
mvn clean
mvn clean install
我遇到过同样的问题。我已将 maven-assembly-plugin
从 POM.xml
中的 2.5.3
更改为 3.1.1
建议的版本应该在插件部分下完成。在此处输入 maven-assembly-plugin
的工件 ID 代码
只需删除 .m2 文件夹中的存储库文件夹即可解决同样的问题。
考虑更改项目中使用的 JDK。对我来说,我将 JDK 从 1.6 更改为 1.8 并更新了 maven。
对于所有 Windows 用户,请尝试将您的代码库移动到较短的 windows 路径,例如:C:/myProj
深度嵌套的 Maven jar 文件可以在 windows 中创建更长的文件路径。由于 windows OS,默认情况下,将文件路径长度限制为 260 个字符,因此在尝试读取位于超过 260 个字符的路径中的文件时会抛出异常。
您可以更改此默认值以将此限制增加到超过 260 个字符。在网络上搜索,您会发现很多关于如何做到这一点的帖子。
您在使用 npm 包时也会遇到类似的问题。
我遇到了同样的问题,但在我的例子中,我只需要将我的项目指向 JDK 而不是构建路径中的 JRE 然后它解决了问题并且我能够导入所有maven依赖没问题!
None 其他答案对我有用。对我有用的解决方案是通过 cmd 手动下载丢失的工件:
mvn dependency:get -DrepoUrl=http://repo.maven.apache.org/maven2/ -Dartifact=ro.isdc.wro4j:wro4j-maven-plugin:1.8 .0
就我而言,我的问题是我使用的是旧版本的 NetBeans。 Maven 存储库删除了一个 http 引用,但 Netbeans 中的嵌入式 Maven 具有该 http 引用 hard-coded。一开始我真的很困惑,因为我的 pom.xml 引用了正确的 https://repo.maven.apache.org/maven2.
修复它非常简单。我从以下位置下载了 Maven 的最新 zip 存档并将其解压缩到我的机器上:
https://maven.apache.org/download.cgi
在 Netbeans 的工具 -> 选项 -> Java -> Maven 的“执行”部分,我将“Maven Home”设置为新提取的 zip 文件位置。
现在我可以构建我的项目了....
这就是我在 IntelliJIdea 中的作用:
转到文件 -> 构建、执行、部署 -> 构建工具 - > Maven -> 存储库
检查是否有两个存储库:
https://repo.maven.apache.org/maven2 (Remote)
C:/Users/_user_/.m2/repository (Local)
然后点击 Update 两个 repos。远程仓库的更新需要一段时间,不过最后点击确定就可以了。
从 spring initializr 创建示例应用程序后,我在 运行 来自我的 IntellijIdea 的应用程序之后遇到了相同类型的错误 Cannot resolve plugin org.apache.maven.plugins:maven-install-plugin:2.5.2
。
在我的项目目录中,我从 intellijIdea 打开文件夹 mvnw
它在此文件顶部显示 install
的选项
我点击了 install
安装成功后,我再次运行 spring 应用程序,它运行 没有给出任何错误。
- 在Maven文件夹的conf文件夹下找到settings.xml。
- 找到代理标签,添加以下内容。
<proxies>
<proxy>
<id>proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>your company host</host>
<port>your company port</port>
</proxy>
</proxies>
我已经在我的机器上安装了maven。我已经正确设置了 class-path 和 maven 主文件夹。每次我执行 mvn clean install
,它都会给我异常。我也试过删除 .m2 文件夹,但结果相同。
mvn -version 输出
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T19:57:37+08:00) Maven home: C:\maven-3 Java version: 1.7.0_45, vendor: Oracle Corporation Java home: D:\jdk170_45\jre Default locale: en_US, platform encoding: MS950 OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
log for mvn -X clean install
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T19:57:37+08:00) Maven home: C:\maven-3 Java version: 1.7.0_45, vendor: Oracle Corporation Java home: D:\jdk170_45\jre Default locale: en_US, platform encoding: MS950 OS name: "windows 7", version: "6.1", arch: "x86", family: "windows" [DEBUG] Created new class realm maven.api [DEBUG] Importing foreign packages into class realm maven.api [DEBUG] Imported: javax.enterprise.inject.* < plexus.core [DEBUG] Imported: javax.enterprise.util.* < plexus.core [DEBUG] Imported: javax.inject.* < plexus.core [DEBUG] Imported: org.apache.maven.* < plexus.core [DEBUG] Imported: org.apache.maven.artifact < plexus.core [DEBUG] Imported: org.apache.maven.classrealm < plexus.core [DEBUG] Imported: org.apache.maven.cli < plexus.core [DEBUG] Imported: org.apache.maven.configuration < plexus.core [DEBUG] Imported: org.apache.maven.exception < plexus.core [DEBUG] Imported: org.apache.maven.execution < plexus.core [DEBUG] Imported: org.apache.maven.execution.scope < plexus.core [DEBUG] Imported: org.apache.maven.lifecycle < plexus.core [DEBUG] Imported: org.apache.maven.model < plexus.core [DEBUG] Imported: org.apache.maven.monitor < plexus.core [DEBUG] Imported: org.apache.maven.plugin < plexus.core [DEBUG] Imported: org.apache.maven.profiles < plexus.core [DEBUG] Imported: org.apache.maven.project < plexus.core [DEBUG] Imported: org.apache.maven.reporting < plexus.core [DEBUG] Imported: org.apache.maven.repository < plexus.core [DEBUG] Imported: org.apache.maven.rtinfo < plexus.core [DEBUG] Imported: org.apache.maven.settings < plexus.core [DEBUG] Imported: org.apache.maven.toolchain < plexus.core [DEBUG] Imported: org.apache.maven.usability < plexus.core [DEBUG] Imported: org.apache.maven.wagon.* < plexus.core [DEBUG] Imported: org.apache.maven.wagon.authentication < plexus.core [DEBUG] Imported: org.apache.maven.wagon.authorization < plexus.core [DEBUG] Imported: org.apache.maven.wagon.events < plexus.core [DEBUG] Imported: org.apache.maven.wagon.observers < plexus.core [DEBUG] Imported: org.apache.maven.wagon.proxy < plexus.core [DEBUG] Imported: org.apache.maven.wagon.repository < plexus.core [DEBUG] Imported: org.apache.maven.wagon.resource < plexus.core [DEBUG] Imported: org.codehaus.classworlds < plexus.core [DEBUG] Imported: org.codehaus.plexus.* < plexus.core [DEBUG] Imported: org.codehaus.plexus.classworlds < plexus.core [DEBUG] Imported: org.codehaus.plexus.component < plexus.core [DEBUG] Imported: org.codehaus.plexus.configuration < plexus.core [DEBUG] Imported: org.codehaus.plexus.container < plexus.core [DEBUG] Imported: org.codehaus.plexus.context < plexus.core [DEBUG] Imported: org.codehaus.plexus.lifecycle < plexus.core [DEBUG] Imported: org.codehaus.plexus.logging < plexus.core [DEBUG] Imported: org.codehaus.plexus.personality < plexus.core [DEBUG] Imported: org.codehaus.plexus.util.xml.Xpp3Dom < plexus.core [DEBUG] Imported: org.codehaus.plexus.util.xml.pull.XmlPullParser < plexus.core [DEBUG] Imported: org.codehaus.plexus.util.xml.pull.XmlPullParserException < plexus.core [DEBUG] Imported: org.codehaus.plexus.util.xml.pull.XmlSerializer < plexus.core [DEBUG] Imported: org.eclipse.aether.* < plexus.core [DEBUG] Imported: org.eclipse.aether.artifact < plexus.core [DEBUG] Imported: org.eclipse.aether.collection < plexus.core [DEBUG] Imported: org.eclipse.aether.deployment < plexus.core [DEBUG] Imported: org.eclipse.aether.graph < plexus.core [DEBUG] Imported: org.eclipse.aether.impl < plexus.core [DEBUG] Imported: org.eclipse.aether.installation < plexus.core [DEBUG] Imported: org.eclipse.aether.internal.impl < plexus.core [DEBUG] Imported: org.eclipse.aether.metadata < plexus.core [DEBUG] Imported: org.eclipse.aether.repository < plexus.core [DEBUG] Imported: org.eclipse.aether.resolution < plexus.core [DEBUG] Imported: org.eclipse.aether.spi < plexus.core [DEBUG] Imported: org.eclipse.aether.transfer < plexus.core [DEBUG] Imported: org.eclipse.aether.version < plexus.core [DEBUG] Imported: org.slf4j.* < plexus.core [DEBUG] Imported: org.slf4j.spi.* < plexus.core [DEBUG] Populating class realm maven.api [INFO] Error stacktraces are turned on. [DEBUG] Reading global settings from C:\maven-3\conf\settings.xml [DEBUG] Reading user settings from C:\Users\H1514\.m2\settings.xml [DEBUG] Reading global toolchains from C:\maven-3\conf\toolchains.xml [DEBUG] Reading user toolchains from C:\Users\H1514\.m2\toolchains.xml [DEBUG] Using local repository at C:\Users\H1514\.m2\repository [DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for C:\Users\H1514\.m2\repository [INFO] Scanning for projects... [DEBUG] Extension realms for project camel:camel:jar:0.0.1-SNAPSHOT: (none) [DEBUG] Looking up lifecyle mappings for packaging jar from ClassRealm[plexus.core, parent: null] [DEBUG] === REACTOR BUILD PLAN ================================================ [DEBUG] Project: camel:camel:jar:0.0.1-SNAPSHOT [DEBUG] Tasks: [clean, install] [DEBUG] Style: Regular [DEBUG] ======================================================================= [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building camel 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy] [DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean] [DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy] [DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy] [DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean] [DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy] [DEBUG] Using transporter WagonTransporter with priority -1.0 for https://repo.maven.apache.org/maven2 [DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://repo.maven.apache.org/maven2 Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom [DEBUG] Writing tracking file C:\Users\H1514\.m2\repository\org\apache\maven\plugins\maven-clean-plugin.5\maven-clean-plugin-2.5.pom.lastUpdated [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 22.858 s [INFO] Finished at: 2015-05-29T14:11:00+08:00 [INFO] Final Memory: 5M/15M [INFO] ------------------------------------------------------------------------ [ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/23.235.47.215] failed: Connection timed out: connect -> [Help 1] org.apache.maven.plugin.PluginResolutionException: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5 at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:117) at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor(DefaultMavenPluginManager.java:179) at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor(DefaultMavenPluginManager.java:298) at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(DefaultBuildPluginManager.java:241) at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecution(DefaultLifecycleExecutionPlanCalculator.java:169) at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecutions(DefaultLifecycleExecutionPlanCalculator.java:155) at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:131) at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:145) at org.apache.maven.lifecycle.internal.builder.BuilderCommon.resolveBuildPlan(BuilderCommon.java:96) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:109) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286) at org.apache.maven.cli.MavenCli.main(MavenCli.java:197) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5 at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:302) at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:218) at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:287) at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:103) ... 26 more Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/23.235.47.215] failed: Connection timed out: connect at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223) at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:287) ... 29 more Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/23.235.47.215] failed: Connection timed out: connect at org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed(ArtifactTransportListener.java:43) at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:355) at org.eclipse.aether.util.concurrency.RunnableErrorForwarder.run(RunnableErrorForwarder.java:67) at org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute(BasicRepositoryConnector.java:581) at org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:249) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:520) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421) ... 32 more Caused by: org.apache.maven.wagon.TransferFailedException: Connect to repo.maven.apache.org:443 [repo.maven.apache.org/23.235.47.215] failed: Connection timed out: connect at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:1066) at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:960) at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116) at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88) at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61) at org.eclipse.aether.transport.wagon.WagonTransporter$GetTaskRunner.run(WagonTransporter.java:560) at org.eclipse.aether.transport.wagon.WagonTransporter.execute(WagonTransporter.java:427) at org.eclipse.aether.transport.wagon.WagonTransporter.get(WagonTransporter.java:404) at org.eclipse.aether.connector.basic.BasicRepositoryConnector$GetTaskRunner.runTask(BasicRepositoryConnector.java:447) at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:350) ... 37 more Caused by: org.apache.maven.wagon.providers.http.httpclient.conn.HttpHostConnectException: Connect to repo.maven.apache.org:443 [repo.maven.apache.org/23.235.47.215] failed: Connection timed out: connect at org.apache.maven.wagon.providers.http.httpclient.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:140) at org.apache.maven.wagon.providers.http.httpclient.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:318) at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:363) at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.MainClientExec.execute(MainClientExec.java:219) at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195) at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec.execute(RetryExec.java:86) at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RedirectExec.execute(RedirectExec.java:108) at org.apache.maven.wagon.providers.http.httpclient.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184) at org.apache.maven.wagon.providers.http.httpclient.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82) at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.execute(AbstractHttpClientWagon.java:832) at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:983) ... 46 more Caused by: java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:579) at org.apache.maven.wagon.providers.http.httpclient.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:239) at org.apache.maven.wagon.providers.http.httpclient.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:123) ... 56 more [ERROR] [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
您的调试输出表明 Clean 是它尝试的第一件事 运行,所以我猜它无法从 central 下载任何插件。
首先,看看您是否可以直接在网络浏览器中下载插件 jar:http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.jar
如果可行,那么您的 Web 浏览器可以连接到 Central,但 Maven 不能。这向我表明您的网络浏览器正在使用 Maven 未配置使用的代理。
对 Maven 代理设置进行了深入描述 here。为了简化一点填写(用您的互联网设置中的值替换 protocol/host/port)并将其放入 Maven settings.xml
文件的 <settings>
标记中:
<proxies>
<proxy>
<id>proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxy.example.com</host>
<port>8080</port>
</proxy>
</proxies>
我遇到了同样的问题,但通过 setting.xml(.*\apache-maven-3.3.3\apache-maven-3.3.3\conf)
中的一些更改解决了。
<proxies>
<proxy>
<id>proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>HOSTNAME</host>
<port>PORT</port>
</proxy>
</proxies>
只需在 IE 设置 -> 连接 -> LAN 设置 -> 代理服务器中检查主机名和端口
希望这也能解决您的问题:)
我遇到了同样的问题,即使我正在使用我的家庭 wifi 连接,没有任何代理要求。
我的项目创建于 c:\users\<>\Workspace\Project\
当我去上面的位置和运行
mvn clean install
我遇到以下错误:
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its de
endencies could not be resolved: Failed to read artifact descriptor for org.apa
he.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer artifact org.ap
che.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (https://repo.mave
.apache.org/maven2)
我花了一整天的时间来尝试各种方法来破解这个问题,但就我而言,解决方案非常简单。
我将我的项目移动到非用户特定位置,在 E:\Workspace\Project\
这对我来说太神奇了!
可能是您忘记指定设置,我就是这样。
尝试:
mvn clean install -s settings_file.xml
我遇到了同样的问题,看到我尝试过的所有选项并且 none 都有效,我感到很沮丧,
一旦您正确配置了所有内容,包括 settings.xml
只需清除本地存储库文件夹并尝试 mvn 命令。这对我帮助很大
希望这对其他人有帮助
由于无法访问maven官方仓库导致的错误。此存储库 (https://repo.maven.apache.org/maven2/) 不可访问,因此请按照以下步骤操作:
- 首先删除你的/home/user/.m2文件夹
- 在用户主目录中创建 .m2 文件夹,并在 .m2[= 中创建 repository 文件夹33=]
- 将默认 settings.xml 复制到 .m2 文件夹
- 在settings.xml如下快照中更改镜像如下 mirror_settings
<mirrors>
<mirror>
<id>UK</id>
<name>UK Central</name>
<url>http://uk.maven.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
- 现在执行 mvn clean 命令.....
我遇到了类似的问题。尝试按照以下步骤操作: 手动删除 .m2 文件夹。 请参阅 settings.xml 文件并检查存储库详细信息是否正确,例如 id 和 url 标签。 还要确保您连接到同一网络并检查 URL 是否可以从浏览器访问。 最后将 Maven 项目保存在 /home/User/.
问题可能是 JVM 客户端不信任 repo.maven.apache.org 证书。 根据建议,您可以尝试在浏览器中访问 https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom。
如果可行 - 可能就是这种情况。 您必须明确告诉 JMV 信任 Maven 证书。 可以参考这里的回答"PKIX path building failed" and "unable to find valid certification path to requested target"
我 Mac OS,证书文件位于 /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/security 并且您需要的证书是当您输入上面提到的 URL
时呈现给浏览器的证书我通过从 open jdk 8.
切换到 oracle jdk 解决了这个问题$ java -版本 java 版本“1.8.0_221” Java(TM) SE 运行时环境(build 1.8.0_221-b11) Java HotSpot(TM) 64 位服务器 VM(内部版本 25.221-b11,混合模式)
参考 Deepak Vishwakarma 的回答,我试过了,但遇到了与 url 相同的问题-问题。我安装了 maven-3.6.3
并在 .m2
文件夹中找到了一个
settings.xml.bak
文件并从中复制了那个镜像 link 并且只是更改了 url @Deepak 所做的。它像魅力一样工作! 镜像 link 我从那个 .bak 文件
http://local.maven.repo:9081/nexus/content/groups/public
然后执行:
mvn clean
mvn clean install
我遇到过同样的问题。我已将 maven-assembly-plugin
从 POM.xml
2.5.3
更改为 3.1.1
建议的版本应该在插件部分下完成。在此处输入 maven-assembly-plugin
只需删除 .m2 文件夹中的存储库文件夹即可解决同样的问题。
考虑更改项目中使用的 JDK。对我来说,我将 JDK 从 1.6 更改为 1.8 并更新了 maven。
对于所有 Windows 用户,请尝试将您的代码库移动到较短的 windows 路径,例如:C:/myProj
深度嵌套的 Maven jar 文件可以在 windows 中创建更长的文件路径。由于 windows OS,默认情况下,将文件路径长度限制为 260 个字符,因此在尝试读取位于超过 260 个字符的路径中的文件时会抛出异常。
您可以更改此默认值以将此限制增加到超过 260 个字符。在网络上搜索,您会发现很多关于如何做到这一点的帖子。
您在使用 npm 包时也会遇到类似的问题。
我遇到了同样的问题,但在我的例子中,我只需要将我的项目指向 JDK 而不是构建路径中的 JRE 然后它解决了问题并且我能够导入所有maven依赖没问题!
None 其他答案对我有用。对我有用的解决方案是通过 cmd 手动下载丢失的工件:
mvn dependency:get -DrepoUrl=http://repo.maven.apache.org/maven2/ -Dartifact=ro.isdc.wro4j:wro4j-maven-plugin:1.8 .0
就我而言,我的问题是我使用的是旧版本的 NetBeans。 Maven 存储库删除了一个 http 引用,但 Netbeans 中的嵌入式 Maven 具有该 http 引用 hard-coded。一开始我真的很困惑,因为我的 pom.xml 引用了正确的 https://repo.maven.apache.org/maven2.
修复它非常简单。我从以下位置下载了 Maven 的最新 zip 存档并将其解压缩到我的机器上: https://maven.apache.org/download.cgi
在 Netbeans 的工具 -> 选项 -> Java -> Maven 的“执行”部分,我将“Maven Home”设置为新提取的 zip 文件位置。
现在我可以构建我的项目了....
这就是我在 IntelliJIdea 中的作用:
转到文件 -> 构建、执行、部署 -> 构建工具 - > Maven -> 存储库
检查是否有两个存储库:
https://repo.maven.apache.org/maven2 (Remote)
C:/Users/_user_/.m2/repository (Local)
然后点击 Update 两个 repos。远程仓库的更新需要一段时间,不过最后点击确定就可以了。
从 spring initializr 创建示例应用程序后,我在 运行 来自我的 IntellijIdea 的应用程序之后遇到了相同类型的错误 Cannot resolve plugin org.apache.maven.plugins:maven-install-plugin:2.5.2
。
在我的项目目录中,我从 intellijIdea 打开文件夹 mvnw
它在此文件顶部显示 install
的选项
我点击了 install
安装成功后,我再次运行 spring 应用程序,它运行 没有给出任何错误。
- 在Maven文件夹的conf文件夹下找到settings.xml。
- 找到代理标签,添加以下内容。
<proxies>
<proxy>
<id>proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>your company host</host>
<port>your company port</port>
</proxy>
</proxies>