当前位置 : 主页 > 网络推广 > seo >

Nexus存储库:无法检索org.apache.maven.plugins的插件描述符…

来源:互联网 收集:自由互联 发布时间:2021-06-16
嗨,我已经下载并安装了一个最干净的nexus服务器(刚刚删除了公共访问).然后我像这样改变了我的maven settings.xml settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSc
嗨,我已经下载并安装了一个最干净的nexus服务器(刚刚删除了公共访问).然后我像这样改变了我的maven settings.xml

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
  http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <mirrors>
        <mirror>
            <id>xx</id>
            <name>xx</name>
            <url>http://some.host:8081/nexus/content/groups/allrepos/</url>
            <mirrorOf>*</mirrorOf>
        </mirror>
    </mirrors>
    <servers>
        <server>
            <id>thirdparty</id>
            <username>xxx</username>
            <password>xxx</password>
        </server>
        <server>
            <id>releases</id>
            <username>xxx</username>
            <password>xxx</password>
        </server>
        <server>
            <id>snapshots</id>
            <username>xxx</username>
            <password>xxx</password>
        </server>
        <server>
            <id>central</id>
            <username>xxx</username>
            <password>xxx</password>
        </server>
    </servers>
</settings>

..主机和用户混淆的地方:-)

最后我删除了.m2 / repository / *中的所有内容并输入以下内容:

mvn archetype:generate -DgroupId=home.my.scratch -DartifactId=HelloWorld -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

这将给我一个问题“[警告]无法检索org.apache.maven.plugins的插件描述符:maven-clean-plugin:2.4.1:”错误但在.m2 / repository目录中有一些文件和文件夹再次.因此主机和访问应该正常工作.

这是完全堆栈:

C:\tmp\lala>mvn archetype:generate -DgroupId=home.my.scratch -DartifactId=HelloWorld -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
Bad level value for property: .level
[INFO] Scanning for projects...
Downloading: http://some.host:8081/nexus/content/groups/allrepos/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://some.host:8081/nexus/content/groups/allrepos/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 c
ould not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-install-plugin:jar:2.3.1
Downloading: http://some.host:8081/nexus/content/groups/allrepos/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.7.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-deploy-plugin:2.7: Plugin org.apache.maven.plugins:maven-deploy-plugin:2.7 or one of its dependencies could n
ot be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-deploy-plugin:jar:2.7
Downloading: http://some.host:8081/nexus/content/groups/allrepos/org/apache/maven/plugins/maven-site-plugin/3.0/maven-site-plugin-3.0.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-site-plugin:3.0: Plugin org.apache.maven.plugins:maven-site-plugin:3.0 or one of its dependencies could not b
e resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-site-plugin:jar:3.0
Downloading: http://some.host:8081/nexus/content/groups/allrepos/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 n
ot be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-antrun-plugin:jar:1.3
Downloading: http://some.host:8081/nexus/content/groups/allrepos/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 de
pendencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-assembly-plugin:jar:2.2-beta-5
Downloading: http://some.host:8081/nexus/content/groups/allrepos/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://some.host:8081/nexus/content/groups/allrepos/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://some.host:8081/nexus/content/groups/allrepos/org/codehaus/mojo/maven-metadata.xml
Downloading: http://some.host:8081/nexus/content/groups/allrepos/org/apache/maven/plugins/maven-metadata.xml
[WARNING] Could not transfer metadata org.apache.maven.plugins/maven-metadata.xml from/to mindbusters (http://some.host:8081/nexus/content/groups/allrepos/): Not authorized, Reason
Phrase:Unauthorized.
[WARNING] Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to mindbusters (http://some.host:8081/nexus/content/groups/allrepos/): Not authorized, ReasonPhrase:
Unauthorized.
[WARNING] Failure to transfer org.apache.maven.plugins/maven-metadata.xml from http://some.host:8081/nexus/content/groups/allrepos/ was cached in the local repository, resolution w
ill not be reattempted until the update interval of mindbusters has elapsed or updates are forced. Original error: Could not transfer metadata org.apache.maven.plugins/maven-metadata.xml from
/to mindbusters (http://some.host:8081/nexus/content/groups/allrepos/): Not authorized, ReasonPhrase:Unauthorized.
[WARNING] Failure to transfer org.codehaus.mojo/maven-metadata.xml from http://some.host:8081/nexus/content/groups/allrepos/ was cached in the local repository, resolution will not
 be reattempted until the update interval of mindbusters has elapsed or updates are forced. Original error: Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to mindbuster
s (http://some.host:8081/nexus/content/groups/allrepos/): Not authorized, ReasonPhrase:Unauthorized.
[INFO] ------------------------------------------------------------------------

我错过了什么?

Failed to retrieve plugin descriptor for org.apache.maven.plugins ………

您的nexus存储库未配置为从maven central检索插件.指定< mirrorOf> *< / mirrorOf>时,它希望在其存储中找到插件.因此,当你安装一个干净的nexus服务器时,它开始在nexus本身内搜索maven插件的描述符,而它们位于maven central.

要解决此问题,您必须定义插件存储库以重新路由所有请求以检索maven插件到maven central.

为此,请编辑settings.xml并在配置文件中添加以下代码段.

....
<pluginRepository>
    <id>central</id>
    <!-- This can be any URL -->
    <!-- even something like 'http://central/' will work fine -->
    <url>http://repo1.maven.org/maven2/</url>
    <releases>
        <enabled>true</enabled>
        <updatePolicy>never</updatePolicy>
    </releases>
    <snapshots>
        <enabled>true</enabled>
        <updatePolicy>always</updatePolicy>
    </snapshots>
</pluginRepository>
....

编辑

URL条目可以是任何虚假URL(它不必是任何有效的URL),因为当镜像设置被定义为< mirrorOf> *< / mirrorOf>时,它将始终通过nexus重新路由.

....
<pluginRepository>
 <id>central</id>
 <url>http://central/</url>
 <releases>
    <enabled>true</enabled>
    <updatePolicy>never</updatePolicy>
</releases>
<snapshots>
    <enabled>true</enabled>
    <updatePolicy>always</updatePolicy>
</snapshots>
</pluginRepository>
....
网友评论