Maven从不同存储库的一个插件下载文件 [英] Maven download files from one plugin from different repositories

查看:138
本文介绍了Maven从不同存储库的一个插件下载文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有奇怪的问题。我有自己的远程存储库并上传他们的插件。然后我尝试在打包项目时下载它。 Maven开始从own_remote_repo下载,但下载1个文件开始在repo1.maven.org/maven2上搜索另一个文件,当然找不到插件并失败。



我有之前很多次使用这个回购没有问题。



[edit]



输出:

 正在下载:http://repo1.maven.org/maven2/com/my/maven/plugin/maven-plugin /1.1.3/maven-plugin-1.1.3.pom 
[INFO]无法在资源库中心找到资源'com.my.maven.plugin:maven-plugin:pom:1.1.3'(http: //repo1.maven.org/maven2)
下载:http://< server>:< port> / nexus / content / groups / public / com / my / maven / plugin / maven-plugin / 1.1.3 / maven-plugin-1.1.3.pom
3K下载(maven-plugin-1.1.3.pom)
下载:http://repo1.maven.org/maven2/com/ my / maven / plugin / maven-plugin / 1.1.3 / maven-plugin-1.1.3.jar
[INFO]无法找到资源'com.my.maven.plugin:maven-plugin:maven-plugin :1.1.3'在存储库中心(http://repo1.maven.org/maven2)
[INFO] ------------------------------ ------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------ ------------------------------
[INFO]找不到所需的插件:无法找到插件 - 检查目标名称是否正确:无法从任何存储库下载工件

所以你可以看到在下载maven-plugin-1.1.3.pom maven之后尝试从maven中央存储库下载jar文件....



带有插件的jar文件位于nexus上的相同目录,名称等于maven尝试查找的jar文件。
从nexus下载的maven-plugin-1.1.3.pom是正确的。



任何想法?

解决方案

我从您的问题中了解到,您只有插件问题,我们使用 nexus 作为代理并且必须配置

  $ USER_HOME / .m2 /settings.xml 

请检查您的配置 pluginrepositories 部分如下所示。

 < settings> 
< mirrors>
< mirror>
< id> nexus< / id>
< mirrorof> *< / mirrorof>
< url> http:// nexusurl / content / groups / public< / url>
< / mirror>
< / mirrors>
< profiles>
< profile>
< id> nexus< / id>
< 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>
< / profiles>
< activeprofiles>
< activeprofile> nexus< / activeprofile>
< / activeprofiles>
< / settings>


I have strange problem. I have own remote repository and upload their plugin. Then I try to download it while packaging project. Maven start to download from own_remote_repo but downloading 1 file start to search another files at repo1.maven.org/maven2 and of course could not found plugin and fails.

I have used this repo many times before without problems.

[edit]

output:

Downloading: http://repo1.maven.org/maven2/com/my/maven/plugin/maven-plugin/1.1.3/maven-plugin-1.1.3.pom
[INFO] Unable to find resource 'com.my.maven.plugin:maven-plugin:pom:1.1.3' in repository central (http://repo1.maven.org/maven2)
Downloading: http://<server>:<port>/nexus/content/groups/public/com/my/maven/plugin/maven-plugin/1.1.3/maven-plugin-1.1.3.pom
3K downloaded  (maven-plugin-1.1.3.pom)
Downloading: http://repo1.maven.org/maven2/com/my/maven/plugin/maven-plugin/1.1.3/maven-plugin-1.1.3.jar
[INFO] Unable to find resource 'com.my.maven.plugin:maven-plugin:maven-plugin:1.1.3' in repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] A required plugin was not found: Plugin could not be found - check that the goal name is correct: Unable to download the artifact from any repository

So as you can see after dowloading of the maven-plugin-1.1.3.pom maven try to download jar file from the maven central repo....

The jar file with plugin located in the same directory on the nexus, and the name equalse to jar file that maven try to find. The maven-plugin-1.1.3.pom dowloaded from nexus is correct.

Any ideas?

解决方案

What I understand from your question is that you have only issues with plugins, we use nexus as proxy and had to configure

 $USER_HOME/.m2/settings.xml

Please check your configuration for the pluginrepositories section showed below.

<settings>
    <mirrors>
        <mirror>
            <id>nexus</id>
            <mirrorof>*</mirrorof>
            <url>http://nexusurl/content/groups/public</url>
        </mirror>
    </mirrors>
    <profiles>
        <profile>
            <id>nexus</id>
            <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>
    </profiles>
    <activeprofiles>
        <activeprofile>nexus</activeprofile>
    </activeprofiles>
</settings>

这篇关于Maven从不同存储库的一个插件下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆