无法解决“找不到Metadata org.codehaus.mojo/maven-metadata.xml&quot”因为文件名在maven下载过程中附加了存储库ID
我如何在Maven Resp中配置。在Intellij中,ID“ D-Central”并未附加到“ Maven-metadata.xml”文件名或其他方式,Maven接受“ Maven-Metadata-d-Central.xml”作为插件的文件名?
我正在使用新的Intellij 2021.3.3,并从我们的git存储库中重新插入了一个多模块的Maven 3/Spring 2项目https:// devtools/devtools/devtools/artifactory/repos/
maven将所有工件下载到本地.... m2 \呼吸器
maven设置位于正确的位置c:\ users \ kitekat \ .m2 \ settings.xml
and,正如我通过更改和更改和测试的那样让它们重新加载,由Maven正确阅读。这些是设置:
<mirrors>
<mirror>
<id>d-central</id>
<mirrorOf>*</mirrorOf>
<url>https://devtools/artifactory/repos</url>
<name>Artifactory</name>
</mirror>
</mirrors>
<profiles>
</profile>
<id>default_profile</id>
<pluginRepositories>
<pluginRepository>
<id>d-central</id>
<name>extra Plugin Repo</name>
<url>https://devtools/artifactory/repos</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
我可以使用mvn install -f pom.xml
安装所有应用程序模块,但是我不能像较早的运行
mvn spring-boot:run -e -X -Dspring-boot.run.profiles=myProfile -f pom.xml
Maven抱怨那样启动Spring应用程序:
[DEBUG] Could not find metadata org.apache.maven.plugins/maven-metadata.xml in local (C:\Users\kitekat\.m2\repository)
[DEBUG] Skipped remote request for org.apache.maven.plugins/maven-metadata.xml, locally cached metadata up-to-date
[DEBUG] Could not find metadata org.codehaus.mojo/maven-metadata.xml in local (C:\Users\kitekat\.m2\repository)
[DEBUG] Skipped remote request for org.codehaus.mojo/maven-metadata.xml, locally cached metadata up-to-date
[DEBUG] Could not find metadata org.apache.maven.plugins/maven-metadata.xml in local (C:\Users\kitekat\.m2\repository)
[DEBUG] Could not find metadata org.codehaus.mojo/maven-metadata.xml in local (C:\Users\kitekat\.m2\repository)
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://devtools/artifactory/repos
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://devtools/artifactory/repos
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://devtools/artifactory/repos
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://devtools/artifactory/repos
Downloading from d-central: https://devtools/artifactory/repos/org/apache/maven/plugins/maven-metadata.xml
Downloading from d-central: https://devtools/artifactory/repos/org/codehaus/mojo/maven-metadata.xml
Downloaded from d-central: https://devtools/artifactory/repos/org/apache/maven/plugins/maven-metadata.xml (11 kB at 4.9 kB/s)
Downloaded from d-central: https://devtools/artifactory/repos/org/codehaus/mojo/maven-metadata.xml (20 kB at 8.9 kB/s)
调查上述目录,我看到将新下载的“ maven-metadata.xml”文件到位:
c:\ users \ kitekat.m2 \ repository \ org \ org \ codehaus \ mojo \ mojo \ maven-metadata-d-central.xml.xml C:\ Users \ kitekat.m2 \ repository \ org \ apache \ maven \ plugins \ maven-metadata-d-central.xml,
但:很明显,文件名是设置的ID“ d-central”。 Maven下载过程中的XML设置。
结果,在本地存储库中找不到Spring Boot插件:
“ [错误]当前项目中的前缀'Spring-boot'和插件组[org.apache.maven.plugins,org找不到插件。 codehaus.mojo]可从存储库中获得[local(c:\ users \ kitekat.m2 \ repository),d -Central(https:// devtools/devtools/figtactory/artifactory/repos)] - &gt; org.apache.maven.plugin.prefix.nopluginfoundforpreprefixexception:在当前项目中没有针对前缀“ spring-boot”和plugin组[org.apache.maven.plugins,org.codehaus.mojo]中的前缀“ spring-boot'找到插件[local(c:\ users \ kitekat.m2 \ repository),d-Central(https://devtools/verifactory/repos)]”
How do I configure in Maven resp. in IntelliJ, that the id "d-central" is not appended to the "maven-metadata.xml" filename, or other way round, that Maven accepts "maven-metadata-d-central.xml" as the file name for plugins?
I'm using a fresh IntelliJ 2021.3.3 and re-imported a multi-module Maven 3/ Spring 2 project from our Git repository https://devtools/artifactory/repos/
Maven downloads all artifacts into the local ....m2\respository
Maven settings are located at the correct location C:\Users\kitekat\.m2\settings.xml
and, as I tested by changing and letting them be reloaded, are correctly read by Maven. These are the settings:
<mirrors>
<mirror>
<id>d-central</id>
<mirrorOf>*</mirrorOf>
<url>https://devtools/artifactory/repos</url>
<name>Artifactory</name>
</mirror>
</mirrors>
<profiles>
</profile>
<id>default_profile</id>
<pluginRepositories>
<pluginRepository>
<id>d-central</id>
<name>extra Plugin Repo</name>
<url>https://devtools/artifactory/repos</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
I can install all application modules using mvn install -f pom.xml
but I cannot start the Spring application like I did earlier by running
mvn spring-boot:run -e -X -Dspring-boot.run.profiles=myProfile -f pom.xml
Maven complains:
[DEBUG] Could not find metadata org.apache.maven.plugins/maven-metadata.xml in local (C:\Users\kitekat\.m2\repository)
[DEBUG] Skipped remote request for org.apache.maven.plugins/maven-metadata.xml, locally cached metadata up-to-date
[DEBUG] Could not find metadata org.codehaus.mojo/maven-metadata.xml in local (C:\Users\kitekat\.m2\repository)
[DEBUG] Skipped remote request for org.codehaus.mojo/maven-metadata.xml, locally cached metadata up-to-date
[DEBUG] Could not find metadata org.apache.maven.plugins/maven-metadata.xml in local (C:\Users\kitekat\.m2\repository)
[DEBUG] Could not find metadata org.codehaus.mojo/maven-metadata.xml in local (C:\Users\kitekat\.m2\repository)
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://devtools/artifactory/repos
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://devtools/artifactory/repos
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://devtools/artifactory/repos
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://devtools/artifactory/repos
Downloading from d-central: https://devtools/artifactory/repos/org/apache/maven/plugins/maven-metadata.xml
Downloading from d-central: https://devtools/artifactory/repos/org/codehaus/mojo/maven-metadata.xml
Downloaded from d-central: https://devtools/artifactory/repos/org/apache/maven/plugins/maven-metadata.xml (11 kB at 4.9 kB/s)
Downloaded from d-central: https://devtools/artifactory/repos/org/codehaus/mojo/maven-metadata.xml (20 kB at 8.9 kB/s)
Looking into the mentioned directories, I see the newly downloaded "maven-metadata.xml" files in place:
C:\Users\kitekat.m2\repository\org\codehaus\mojo\maven-metadata-d-central.xml
C:\Users\kitekat.m2\repository\org\apache\maven\plugins\maven-metadata-d-central.xml
But: as is obvious, the file names are appendend the id "d-central" of the settings.xml settings during download by Maven.
As a result, the Spring Boot plugin is not found in the local repository:
"[ERROR] No plugin found for prefix 'spring-boot' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\kitekat.m2\repository), d-central (https://devtools/artifactory/repos)] -> [Help 1]
org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException: No plugin found for prefix 'spring-boot' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\kitekat.m2\repository), d-central (https://devtools/artifactory/repos)]"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我终于可以在回复@khmarbaise时解决问题:偶然地,在设置实验性运行/调试配置时输入了错误的工作目录。将其更正为“ DSP-门户”,然后可以启动应用程序。
请参阅图像
显然,来自settings.xml ID的附录“ d-Central”是正确的行为,并且没有阻止Spring Boot应用程序启动,但是当工作目录未正确设置时,Maven在错误的目录中搜索。
I finally could solve the issue during replying to @khmarbaise: accidentally, a wrong working directory had been entered in setting up the experimental Run/Debug Configuration. Corrected it to "dsp-portal" and could then start the application.
See image
Obviously, the appendend "d-central" from the settings.xml id is a correct behavior and didn't stop the Spring Boot application from starting up, but when the working directory isn't set correctly, Maven searches in the wrong directory.