2011-10-27 38 views
1

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

我以前多次使用此回购没有问题。

[编辑]

输出:

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 

所以你可以在Maven的插件,1.1.3.pom行家的你下载过之后,会尝试从行家中心下载jar文件repo ....

插件jar文件位于nexus上的同一目录中,并且名称与maven试图找到的jar文件相同。 从nexus下载的maven-plugin-1.1.3.pom是正确的。

任何想法?

+1

你可以从maven发布一个示例输出来显示它吗? –

+0

完成。我希望这可以帮助你 – Oleksandr

回答

2

我从你的问题理解的是,你只有使用插件的问题,我们使用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> 
+0

谢谢。将pluginRepositories添加到我的pom.xml,然后maven开始正确下载。但我无法解决主要问题:为什么maven开始从不同的仓库下载部分plubin ... – Oleksandr

相关问题