简体   繁体   English

将自定义存储库与Apache Ivy一起使用,找不到解析器

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

It seems that Apache ivy downloads artifacts only from http://mvnrepository.com/ and few other places, but all the jars are outdated there. 看来Apache ivy仅从http://mvnrepository.com/和其他几个地方下载了工件,但是所有jar都已经过时了。

So I am trying to add custom repository for Ivy. 所以我试图为常春藤添加自定义存储库。 I am using repository Ivy RoundUp : http://code.google.com/p/ivyroundup/ 我正在使用存储库Ivy RoundUp: http : //code.google.com/p/ivyroundup/

This is my configuration, but getting error: 这是我的配置,但出现错误:

build.xml: 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.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.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>

error: 错误:

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

So it seems that it does not find my resolver . 因此,似乎找不到我的解析器 I did configure the resolver like the custom repository asked me to: http://code.google.com/p/ivyroundup/wiki/HowToConfigureIvy 我确实按照自定义存储库的要求配置了解析器: http : //code.google.com/p/ivyroundup/wiki/HowToConfigureIvy

And here is list of all artifacts in that repo, so you can see that Spring 3.0.6 exists in there : http://ivyroundup.googlecode.com/svn/trunk/repo/modules.xml 这是该存储库中所有工件的列表,因此您可以看到其中存在Spring 3.0.6: http : //ivyroundup.googlecode.com/svn/trunk/repo/modules.xml

Any suggestions? 有什么建议么? Feel free to ask more information. 随时询问更多信息。

EDIT: 编辑:

build.properties : 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 is designed around the packager resolver in ivy. Ivyroundup是围绕常春藤中的打包程序解析程序设计的。 This resolver is incredibly clever, demonstrates the true power of ivy, but the bulk of the world uses Maven repositories to host their software. 这个解析器非常聪明,展示了常春藤的真正威力,但是全世界大多数人都使用Maven存储库来托管他们的软件。 Fact is soon Maven Central will contain nearly 90% of the world's Java open source components. 实际上,Maven Central很快将包含全球近90%的Java开源组件。

Enabling Maven repositories 启用Maven存储库

Thankfully, ivy fully understands Maven repositories, meaning we can use ivy as a client and let very good products like Nexus host the repository. 值得庆幸的是,ivy完全了解Maven信息库,这意味着我们可以将ivy用作客户端,并让Nexus等出色产品托管该信息库。 Here's the settings file that enables Maven Central: 这是启用Maven Central的设置文件:

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

I would highly recommend you consider setting up you own local instance of Nexus (Or Artifactory , or Archiva ...). 我强烈建议您考虑设置自己的Nexus本地实例(或ArtifactoryArchiva ...)。 You can then cache Maven central artifacts (more efficient), search for software components and upload and host artifacts which cannot be downloaded, due to license restrictions (JDBC jars). 然后,您可以缓存Maven中央工件(更有效),搜索软件组件,以及由于许可证限制(JDBC jar)而无法下载的上载和托管工件。

Enabling a local repository manager also uses the ibiblio resolver as follows: 启用本地存储库管理器还使用ibiblio解析器,如下所示:

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

Searching Maven Central (New ivy support features) 搜索Maven Central(新的常春藤支持功能)

You're looking for the Spring 3.0.6 release? 您在寻找Spring 3.0.6版本吗? It's already in Maven Central: 它已经在Maven Central中:

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

The Spring core artifact details are here: Spring核心工件的详细信息在这里:

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

The search page now conveniently gives you both the Maven and ivy client declaration to copy into your build: 现在,搜索页面可以方便地为您提供Maven和ivy客户端声明,以将它们复制到您的构建中:

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

您必须要告诉默认解析器是什么,例如<conf defaultResolver =“ default” />

Your update target should invoke ivy:resolve task after ivy:settings. 您的更新目标应在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