Maven download files from one plugin from different repositories

你离开我真会死。 提交于 2019-12-08 00:29:30

问题


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?


回答1:


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>


来源:https://stackoverflow.com/questions/7919010/maven-download-files-from-one-plugin-from-different-repositories

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!