Nexus没有缓存maven中央插件

use*_*322 10 nexus maven

我使用Maven 3.0.4和Nexus 2.0.6.我已将settings.xml设置为使用单个存储库的Nexus指令.当maven尝试运行maven -U clean时,我收到以下错误.

[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.4.1 or one of its d
ependencies could not be resolved: Failed to read artifact descriptor for org.ap
ache.maven.plugins:maven-clean-plugin:jar:2.4.1: Could not find artifact org.apa
che.maven.plugins:maven-clean-plugin:pom:2.4.1 in nexus (http://localhost:8081/n
exus/content/groups/public) -> [Help 1]
Run Code Online (Sandbox Code Playgroud)

如果我从设置中删除nexus镜像并直接进入maven central命令有效.nexus中maven repo的设置显示它正在服务中,并且它位于公共组(最后列出)中.

我不是支持访问互联网的代理人.

这是我的settings.xml

<?xml version="1.0" encoding="UTF-8"?>
<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">
<offline>false</offline>
<mirrors>
    <mirror>
        <!--This sends everything else to /public -->
        <id>nexus</id>
        <mirrorOf>*</mirrorOf>
        <url>http://localhost:8081/nexus/content/groups/public</url>
    </mirror>
</mirrors>
<profiles>
    <profile>
        <id>nexus</id>
        <!--Enable snapshots for the built in central repo to direct -->
        <!--all requests to nexus via the mirror -->
        <repositories>
            <repository>
                <id>central</id>
                <url>http://central</url>
                <releases><enabled>true</enabled></releases>
                <snapshots><enabled>true</enabled></snapshots>
            </repository>
        </repositories>
        <pluginRepositories>
            <pluginRepository>
                <id>central</id>
                <url>http://central</url>
                <releases><enabled>true</enabled></releases>
                <snapshots><enabled>true</enabled></snapshots>
            </pluginRepository>
        </pluginRepositories>
    </profile>
    <profile>
        <id>maven-central</id>
        <!--Enable snapshots for the built in central repo to direct -->
        <!--all requests to nexus via the mirror -->
        <repositories>
            <repository>
                <id>central</id>
                <url>http://repo1.maven.org/maven2/</url>
                <releases><enabled>true</enabled></releases>
                <snapshots><enabled>true</enabled></snapshots>
            </repository>
        </repositories>
        <pluginRepositories>
            <pluginRepository>
                <id>central</id>
                <url>http://repo1.maven.org/maven2/</url>
                <releases><enabled>true</enabled></releases>
                <snapshots><enabled>true</enabled></snapshots>
            </pluginRepository>
        </pluginRepositories>
     </profile>
</profiles>
    <activeProfiles>
    <!--make the profile active all the time -->
    <activeProfile>nexus</activeProfile>
</activeProfiles>


</settings>
Run Code Online (Sandbox Code Playgroud)

Ser*_*riu 5

确保Central已正确配置代理存储库,并且代理URL为http://repo1.maven.org/maven2/.检查您是否可以在存储库的URL中看到缓存的工件http://localhost:8081/nexus/content/repositories/central/org/apache/maven/plugins/maven-clean-plugin/2.4.0/maven-clean-plugin-2.4.1.pom.

确保你有一个中央代理,是否列出了任何内容http://localhost:8081/nexus/content/repositories/central/.

如果您位于代理后面,则可以在" 管理" - >"Nexus"窗格的" 默认HTTP代理设置(可选)"部分下配置代理.

然后,确保将Public Repositories组存储库配置为Central在其包含的存储库列表中包含存储库.

如果到目前为止一切正常,请检查日志,也许那里有一条有用的消息.


小智 3

尝试直接通过网络浏览器下载:

http://localhost:8081/nexus/content/groups/public/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom
Run Code Online (Sandbox Code Playgroud)

如果这不起作用,请检查 sonatype-work/nexus/logs/nexus.log 文件以获取有关失败的更多信息。