2012-01-19 121 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。

相關問題