簡體   English   中英

將自定義存儲庫與Apache Ivy一起使用,找不到解析器

[英]Using a custom repository with Apache Ivy, no resolver found

看來Apache ivy僅從http://mvnrepository.com/和其他幾個地方下載了工件,但是所有jar都已經過時了。

所以我試圖為常春藤添加自定義存儲庫。 我正在使用存儲庫Ivy RoundUp: http : //code.google.com/p/ivyroundup/

這是我的配置,但出現錯誤:

build.xml:

<target name="update" depends="init-ivy" description="Download project dependencies">
    <!-- edited for brevity -->
    <ivy:settings file="ivysettings.xml" />
    <ivy:retrieve pattern="war/WEB-INF/lib/[artifact]-[revision].[ext]" />
    <!-- edited for brevity -->
</target>

ivy.xml:

<ivy-module version="2.0">
    <info organisation="org.apache" module="hello-ivy"/>
    <dependencies>
        <dependency org="org.springframework" name="spring" rev="3.0.6" conf="default->master"/>

    </dependencies>
</ivy-module>

ivysettings.xml:

<ivysettings>
    <resolvers>
        <packager name="roundup" buildRoot="${user.home}/.ivy2/packager/build" resourceCache="${user.home}/.ivy2/packager/cache">
            <ivy pattern="http://ivyroundup.googlecode.com/svn/trunk/repo/modules/[organisation]/[module]/[revision]/ivy.xml"/>
            <artifact pattern="http://ivyroundup.googlecode.com/svn/trunk/repo/modules/[organisation]/[module]/[revision]/packager.xml"/>
        </packager>
    </resolvers>
</ivysettings>

錯誤:

Buildfile: C:\Users\Jansu\workspace\HibernateSpring\build.xml
build:
deploywar:
      [war] Building war: C:\Users\Jansu\workspace\HibernateSpring\hibernate.war
     [copy] Copying 1 file to C:\apache-tomcat-7.0.20\webapps
download-ivy:
      [get] Getting: http://repo2.maven.org/maven2/org/apache/ivy/ivy/2.2.0/ivy-2.2.0.jar
      [get] To: C:\Users\Jansu\.ant\lib\ivy-2.2.0.jar
      [get] Not modified - so not downloaded
init-ivy:
update:
[ivy:retrieve] :: Ivy 2.2.0 - 20100923230623 :: http://ant.apache.org/ivy/ ::
[ivy:retrieve] :: loading settings :: file = C:\Users\Jansu\workspace\HibernateSpring\ivysettings.xml
[ivy:retrieve] :: resolving dependencies :: org.apache#hello-ivy;working@Jansu-PC
[ivy:retrieve]  confs: [default]
[ivy:retrieve] :: resolution report :: resolve 110ms :: artifacts dl 0ms
    ---------------------------------------------------------------------
    |                  |            modules            ||   artifacts   |
    |       conf       | number| search|dwnlded|evicted|| number|dwnlded|
    ---------------------------------------------------------------------
    |      default     |   1   |   0   |   0   |   0   ||   0   |   0   |
    ---------------------------------------------------------------------
[ivy:retrieve] :: problems summary ::
[ivy:retrieve] :::: WARNINGS
[ivy:retrieve]      ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]      ::          UNRESOLVED DEPENDENCIES         ::
[ivy:retrieve]      ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]      :: org.springframework#spring;3.0.6: no resolver found for org.springframework#spring: check your configuration
[ivy:retrieve]      ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve] 
[ivy:retrieve] :::: ERRORS
[ivy:retrieve]  unknown resolver null
[ivy:retrieve]  no resolver found for org.springframework#spring: check your configuration
[ivy:retrieve] 
[ivy:retrieve] :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS

BUILD FAILED
C:\Users\Jansu\workspace\HibernateSpring\build.xml:177: impossible to resolve dependencies:
    resolve failed - see output for details

Total time: 2 seconds

因此,似乎找不到我的解析器 我確實按照自定義存儲庫的要求配置了解析器: http : //code.google.com/p/ivyroundup/wiki/HowToConfigureIvy

這是該存儲庫中所有工件的列表,因此您可以看到其中存在Spring 3.0.6: http : //ivyroundup.googlecode.com/svn/trunk/repo/modules.xml

有什么建議么? 隨時詢問更多信息。

編輯:

build.properties:

ivy.install.version=2.2.0
ivy.home=${user.home}/.ant
ivy.jar.dir=${ivy.home}/lib
ivy.jar.file=${ivy.jar.dir}/ivy-${ivy.install.version}.jar

Ivyroundup是圍繞常春藤中的打包程序解析程序設計的。 這個解析器非常聰明,展示了常春藤的真正威力,但是全世界大多數人都使用Maven存儲庫來托管他們的軟件。 實際上,Maven Central很快將包含全球近90%的Java開源組件。

啟用Maven存儲庫

值得慶幸的是,ivy完全了解Maven信息庫,這意味着我們可以將ivy用作客戶端,並讓Nexus等出色產品托管該信息庫。 這是啟用Maven Central的設置文件:

<ivysettings>
  <settings defaultResolver='central'/>
  <resolvers>
    <ibiblio name='central' m2compatible='true'/>
  </resolvers>
</ivysettings>

我強烈建議您考慮設置自己的Nexus本地實例(或ArtifactoryArchiva ...)。 然后,您可以緩存Maven中央工件(更有效),搜索軟件組件,以及由於許可證限制(JDBC jar)而無法下載的上載和托管工件。

啟用本地存儲庫管理器還使用ibiblio解析器,如下所示:

<ivysettings>
  <settings defaultResolver='nexus'/>
  <resolvers>
    <ibiblio name='nexus' m2compatible='true' root='https://nexus.mydomain.com:8081/nexus/content/groups/central/' />
  </resolvers>
</ivysettings>

搜索Maven Central(新的常春藤支持功能)

您在尋找Spring 3.0.6版本嗎? 它已經在Maven Central中:

http://search.maven.org/#search|ga|1|g%3A%22org.springframework%22%20AND%20v%3A%223.0.6.RELEASE%22

Spring核心工件的詳細信息在這里:

http://search.maven.org/#artifactdetails|org.springframework|spring-core|3.0.6.RELEASE|jar

現在,搜索頁面可以方便地為您提供Maven和ivy客戶端聲明,以將它們復制到您的構建中:

<dependency org="org.springframework" name="spring-core" rev="3.0.6.RELEASE" >
    <artifact name="spring-core" type="jar" />
</dependency>

您必須要告訴默認解析器是什么,例如<conf defaultResolver =“ default” />

您的更新目標應在ivy:settings之后調用ivy:resolve任務。

<target name="update" depends="init-ivy" description="Download project dependencies">
  <ivy:settings file="ivysettings.xml" />
  <ivy:resolve conf="default" />
  <ivy:retrieve pattern="war/WEB-INF/lib/[artifact]-[revision].[ext]" />
</target>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM