我面临一个奇怪的问题。我已在settings.xml
中编辑了Maven M2_HOME/conf
文件,并希望将这些文件下载到{users.home}/.m2
以外的地方。
我已将<localRepository>G:/m2Repo</localRepository>
粘贴到settings.xml
。
现在当我输入mvn archetype:generate
时,我收到以下错误:
[INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'archetype'. [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exist or no valid version could be found [INFO] ------------------------------------------------------------------------ [INFO] Trace org.apache.maven.lifecycle.LifecycleExecutionException: The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exist or no valid version could be found at org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1569) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.getMojoDescriptor(DefaultLifecycleExecutor.java:1851) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.segmentTaskListByAggregationNeeds(DefaultLifecycleExecutor.java:462) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:175) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138) at org.apache.maven.cli.MavenCli.main(MavenCli.java:362) at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) at org.codehaus.classworlds.Launcher.main(Launcher.java:375) Caused by: org.apache.maven.plugin.version.PluginVersionNotFoundException: The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exist or no valid version could be found at org.apache.maven.plugin.version.DefaultPluginVersionManager.resolvePluginVersion(DefaultPluginVersionManager.java:229) at org.apache.maven.plugin.version.DefaultPluginVersionManager.resolvePluginVersion(DefaultPluginVersionManager.java:91) at org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManager.java:179) at org.apache.maven.plugin.DefaultPluginManager.loadPluginDescriptor(DefaultPluginManager.java:1642) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1540) ... 15 more [INFO] ------------------------------------------------------------------------
可能是什么问题?
答案 0 :(得分:2)
如果工件或元数据损坏,就会发生这种情况。尝试删除所有版本的maven-archetype-plugin
(包括元数据和pom文件),以清除您的本地存储库。
然后再次执行archetype:generate
。
答案 1 :(得分:0)
通过在settings.xml中删除localRepository的条目来解决该问题。 开始再次生成原型 将下载的工件移动到我们想要的地方G:/ m2Repo 再次开始生成工件。 现在罐子等会自动下载到新地方
我能想到的问题是我还删除了{users.home} /.m2文件夹 这阻止了下载。
答案 2 :(得分:0)
我有一个类似的问题。
环境:
`OS`: Mac Seirra 10.12.6.
`Java version` :1.8.0_144
`Maven` 3.5.4
解决方案:
rm -rf ~/.m2/repository/org/apache/maven/plugins/maven-archetype-plugin/
答案 3 :(得分:-1)
我的错误是:
(http://mirrors.ibiblio.org/pub/mirrors/maven2):
在任何插件存储库中找不到插件
解决方案:
1. go to .m2 folder > repository
2. delete all folders inside this
3. try the following command again:
mvn archetype:generate