Apache ivy似乎只从http://mvnrepository.com/和其他几个地方下载工件,但所有的jar都过时了。
所以我试图为Ivy添加自定义存储库。我正在使用存储库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-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:UsersJansuworkspaceHibernateSpringbuild.xml
build:
deploywar:
[war] Building war: C:UsersJansuworkspaceHibernateSpringhibernate.war
[copy] Copying 1 file to C:apache-tomcat-7.0.20webapps
download-ivy:
[get] Getting: http://repo2.maven.org/maven2/org/apache/ivy/ivy/2.2.0/ivy-2.2.0.jar
[get] To: C:UsersJansu.antlibivy-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:UsersJansuworkspaceHibernateSpringivysettings.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:UsersJansuworkspaceHibernateSpringbuild.xml:177: impossible to resolve dependencies:
resolve failed - see output for details
Total time: 2 seconds
所以它似乎没有找到我的解析器。我确实按照自定义存储库的要求配置了解析器:http://code.google.com/p/ivyroundup/wiki/HowToConfigureIvy
这里是该repo中所有构件的列表,因此您可以看到Spring 3.0.6存在:http://ivyroundup.googlecode.com/svn/trunk/repo/modules.xml
有什么建议吗?请随时询问更多信息。
编辑:构建。属性:
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是围绕ivy中的打包器解析器设计的。这个解析器非常聪明,展示了ivy的真正力量,但世界上大多数人都使用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实例(或Artifactory或Archiva…)。然后,您可以缓存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中心(新的ivy支持功能)
你正在寻找Spring 3.0.6版本?它已经在Maven Central中:
http://search.maven.org/ga搜索| | 1 | 3 g % % 22 org.springframework % 20 - 22% % 20 v % % 223.0.6.RELEASE % 22 3
Spring核心工件细节在这里:
http://search.maven.org/artifactdetails | org.springframework | spring核心| 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>
为完整起见…
ivysettings.xml
与
- https://maven.org
- https://jitpack.io/
<ivysettings>
<settings defaultResolver="default-chain"/>
<resolvers>
<chain name="default-chain">
<!-- default resolver
<ibiblio name="maven.org" m2compatible="true" root="https://repo1.maven.org/maven2"/>
-->
<ibiblio name="maven.org" m2compatible="true"/>
<!-- resolver for github
example use in ivy.xml: https://github.com/omajid/xdg-java
<dependency org="com.github.omajid" name="xdg-java" rev="7c623b86e6b99bef0a72db86318663ad3c0270e5" conf="compile->master"/>
-->
<ibiblio name="jitpack.io" m2compatible="true" root="https://jitpack.io/"/>
</chain>
</resolvers>
</ivysettings>
您的更新目标应该在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>
你必须有一些东西告诉你默认的解析器是什么,比如,conf defaultResolver="default"/>