2012-01-19 107 views
7

我想将我的自定义maven插件上传到nexus存储库。如何将maven插件上传到Nexus存储库?

我的问题是,当我上传我的插件,通过网络IU像普通的依赖关系,行家不能找到它:

插件com.huawei:Maven的项目版本插件:1.0其中一个 依赖项无法解析:无法读取com.huawei的工件描述符 :maven-project-version-plugin:jar:1.0:未能找到 com.mycompany:maven-project-version-plugin:pom :1.0中的 http://localhost:8081/nexus/content/groups/public被缓存在 本地存储库中,直到更新 连接的时间间隔才会重新解析分辨率已经过去或更新被迫 - > [帮助1]

但是,当我安装我的插件maven本地repositiry(非nexus)通过命令行一切都很好。

那么,安装自定义maven插件和安装“非插件”artefact的区别是什么?有什么技巧吗?

我的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> 
     <!--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> 
    </profiles> 

    <activeProfiles> 
    <!--make the profile active all the time --> 
    <activeProfile>nexus</activeProfile> 
    </activeProfiles> 
</settings> 
+0

需要了解更多关于你的maven设置。你在settings.xml或pom.xml中使用任何插件库吗? – Michael

+0

@Michael正如你所说,我添加了我的settings.xml。但我认为,问题不在于此。我可以从nexus下载所有其他依赖项:托管存储库中的依赖项以及代理存储库中的所有其他依赖项。我可以下载我的插件,如果我将它们标记为。但是当我尝试设置他们像 maven找不到它。 – Sergey

回答

8

的问题得到解决。那么,我不知道如何,但今天都是工作。我认为问题出在Nexus缓存中。我刚刚删除了我的托管存储库并重新创建了它。也许,有一些激进的方法,但我不知道他们=)删除神器,然后只是“过期缓存”没有帮助在我的情况。

嗯,我的问题的答案:除了一个之外,Nexus中的安装插件和非插件工件没有任何区别。如果选择GAV Definition:GAV参数,则必须在组合框“Packaging”中选择“maven-plugin”。

我觉得没有必要一步一步地写指令,这很简单。只需选择您的托管存储库 - > Artifact Upload选项卡并填写必填字段。

4

此外,还必须添加您还必须上传Maven插件的pom。如果你不这样做,Nexus会自动生成一个不正确的。即它只是一个由版本,artifactID,包装和groupID组成的基本pom。

相关问题