2010-03-08 258 views
5

我正在嘗試解決與常春藤時間戳SNAPSHOT依賴關係。解決與從常春藤時間戳SNAPSHOT依賴關係

環境是Ant + Ivy 1.2.0 + Archiva。 Archiva本身是從Maven2構建中填充的。常春藤只用於解決依賴性(來自單個非Maven2項目)。


如何配置Ivy以正確解析來自Archiva或m2存儲庫的時間戳項目?


僅供參考我目前的配置是:

ivysettings.xml類似於:

<ivysettings> 
    <settings defaultResolver="archiva-chain"/> 

    <resolvers> 
     <chain name="archiva-chain" changingPattern=".*SNAPSHOT" checkmodified="true"> 

     <ibiblio name="archiva-internal" 
       m2compatible="true" 
       usepoms="true" 
       pattern="[organization]/[module]/[revision]/[artifact]-[revision].[ext]" 
       root="http://host:port/archiva/repository/internal"/> 

     <ibiblio name="archiva-deploy" 
       m2compatible="true" 
       usepoms="true" 
       pattern="[organization]/[module]/[revision]/[artifact]-[revision].[ext]" 
       root="http://host:port/archiva/repository/deploy"/> 

     <ibiblio name="archiva-snapshots" 
       m2compatible="true" 
       usepoms="true" 
       pattern="[organization]/[module]/[revision]/[artifact]-[revision].[ext]" 
       root="http://host:port/archiva/repository/snapshots"/> 
    </chain> 
    </resolvers> 
</ivysettings> 

的ivy.xml依賴關係很簡單:

<ivy-module version="2.0"> 
    <info organisation="com.myorg" module="myapp"/> 
    <dependencies> 
     <dependency org="com.myorg" name="myartifact" rev="1.8.0-SNAPSHOT" changing="true"/> 
    </dependencies> 
</ivy-module> 

常春藤不會嘗試解析時間戳的工件。例如。

[ivy:retrieve] :: problems summary :: 
[ivy:retrieve] :::: WARNINGS 
[ivy:retrieve]   module not found: com.myorg#myartifact;1.8.0-SNAPSHOT 
[ivy:retrieve] ==== archiva-internal: tried 
[ivy:retrieve] -- artifact com.myorg#myartifact;1.8.0-SNAPSHOT!myartifact.jar: 
[ivy:retrieve] http://host:port/archiva/repository/internal/com.myorg/myartifact/1.8.0-SNAPSHOT/myartifact-1.8.0-SNAPSHOT.jar 
[ivy:retrieve] ==== archiva-deploy: tried 
[ivy:retrieve] -- artifact com.myorg#myartifact;1.8.0-SNAPSHOT!myartifact.jar: 
[ivy:retrieve] http://host:port/archiva/repository/deploy/com.myorg/myartifact/1.8.0-SNAPSHOT/myartifact-1.8.0-SNAPSHOT.jar 
[ivy:retrieve] ==== archiva-snapshots: tried 
[ivy:retrieve] -- artifact com.myorg#myartifact;1.8.0-SNAPSHOT!myartifact.jar: 
[ivy:retrieve] http://host:port/archiva/repository/snapshots/com.myorg/myartifact/1.8.0-SNAPSHOT/myartifact-1.8.0-SNAPSHOT.jar 
[ivy:retrieve]   :::::::::::::::::::::::::::::::::::::::::::::: 
[ivy:retrieve]   ::   UNRESOLVED DEPENDENCIES   :: 
[ivy:retrieve]   :::::::::::::::::::::::::::::::::::::::::::::: 
[ivy:retrieve]   :: com.myorg#myartifact;1.8.0-SNAPSHOT: not found 
[ivy:retrieve]   :::::::::::::::::::::::::::::::::::::::::::::: 
[ivy:retrieve] 
[ivy:retrieve] 
[ivy:retrieve] :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS 

有一個行家-metadata.xml中快照/ COM/MYORG/myartifact

<?xml version="1.0" encoding="UTF-8"?> 

<metadata> 
    <groupId>com.myorg</groupId> 
    <artifactId>myartifact</artifactId> 
    <versioning> 
    <latest>1.8.0-SNAPSHOT</latest> 
    <versions> 
     <version>1.3.0-SNAPSHOT</version> 
     <version>1.4.2-SNAPSHOT</version> 
     <version>1.6.1-SNAPSHOT</version> 
     <version>1.8.0-SNAPSHOT</version> 
    </versions> 
    <lastUpdated>20100303003206</lastUpdated> 
    </versioning> 
</metadata> 

行家-metadata.xml中快照/ COM/MYORG /myartifact/1.8.0-SNAPSHOT

<?xml version="1.0" encoding="UTF-8"?> 

<metadata> 
    <groupId>com.myorg</groupId> 
    <artifactId>myartifact</artifactId> 
    <version>1.8.0-SNAPSHOT</version> 
    <versioning> 
    <snapshot> 
     <buildNumber>7</buildNumber> 
     <timestamp>20100303.003206</timestamp> 
    </snapshot> 
    <lastUpdated>20100303003206</lastUpdated> 
    </versioning> 
</metadata> 

並非所有有用的,但爲了完整起見,在目錄中的文件快照/ COM/MYORG/myartifact/1.8.0-SNAPSHOT所引用的快照:

-rw-r--r-- 1 archiva archiva 240670 Mar 3 10:32 myartifact-1.8.0-20100303.003206-7.jar 
-rw-r--r-- 1 archiva archiva  32 Mar 3 10:32 myartifact-1.8.0-20100303.003206-7.jar.md5 
-rw-r--r-- 1 archiva archiva  40 Mar 3 10:32 myartifact-1.8.0-20100303.003206-7.jar.sha1 
-rw-r--r-- 1 archiva archiva 4068 Mar 3 10:32 myartifact-1.8.0-20100303.003206-7.pom 
-rw-r--r-- 1 archiva archiva  32 Mar 3 10:32 myartifact-1.8.0-20100303.003206-7.pom.md5 
-rw-r--r-- 1 archiva archiva  40 Mar 3 10:32 myartifact-1.8.0-20100303.003206-7.pom.sha1 
-rw-r--r-- 1 archiva archiva 180821 Mar 3 10:32 myartifact-1.8.0-20100303.003206-7-sources.jar 
-rw-r--r-- 1 archiva archiva  32 Mar 3 10:32 myartifact-1.8.0-20100303.003206-7-sources.jar.md5 
-rw-r--r-- 1 archiva archiva  40 Mar 3 10:32 myartifact-1.8.0-20100303.003206-7-sources.jar.sha1 

回答

8

常春藤支持解決時間戳的快照,但有以下限制:您ibiblio上分解的模式必須結束與:

[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext] 

這是不是在你的設置的情況下,這樣常青藤就不會試圖找到自己的時間戳的快照。更新你的模式到這個應該可以解決你的問題;更新您的檔案快照資源庫的定義爲:

<ibiblio name="archiva-snapshots" 
      m2compatible="true" 
      usepoms="true" 
      pattern="[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]" 
      root="http://host:port/archiva/repository/snapshots"/> 

備註:介意[組織]中的's'而不是'z'。

馬騰

+0

這太棒了。它完美的作品。謝謝。 – bradhouse 2010-03-23 02:26:27

相關問題