Apache IVY : Chain tag

孤街醉人 提交于 2020-01-05 08:46:07

问题


I am new to the apache IVY. I was not able to download the springframework.web.servlet from the default repository(MAVEN) as this jar file is not present in maven repository so for adding a new repository which have this file i have used the Chain tag. But the problem is its downloading all the jar files from maven repo and the springframework.web.servlet from other repository but after that its again try to download all the other jar files from the second repository.

ivysettings.xml

<ivysettings>
   <settings defaultCache="${ivy.settings.dir}/ivy-cache" defaultResolver="libraries"/>
   <resolvers>
      <filesystem name="projects">
         <artifact pattern="${repository.dir}/[artifact]-[revision].[ext]" />
         <ivy pattern="${repository.dir}/[module]-[revision].xml" />
      </filesystem>
      <chain name="chained">
         <ibiblio name="libraries" m2compatible="true" usepoms="false" />
         <ibiblio name="lib" m2compatible="true" root="https://oss.sonatype.org/content/repositories/springsource-releases"/> 
      </chain>
   </resolvers>
   <modules>
      <module organisation="com.virtusa" name="dependee" resolver="projects"/>
      <module organisation="org.springframework" name="org.springframework.web.servlet" resolver="lib"/>
   </modules> 
</ivysettings>

ivy.xml

<ivy-module version="1.0">
    <info organisation="com.virtusa" module="depender"/>
    <dependencies>

       <dependency org="org.springframework"  name="spring-core" rev="3.0.4.RELEASE" />
       <dependency org="org.springframework"  name="spring-aop" rev="3.0.4.RELEASE" />
       <dependency org="org.springframework"  name="spring-hibernate3" rev="2.0.8" />
       <dependency org="org.springframework"  name="spring-context" rev="3.0.4.RELEASE" />
       <dependency org="org.springframework"  name="spring-beans" rev="3.0.4.RELEASE" />
       <dependency org="org.springframework"  name="spring-web" rev="3.0.4.RELEASE" />
       <dependency org="org.springframework"  name="spring-webmvc" rev="3.0.4.RELEASE" />
       <!-- Added  -Bauddhik-->
       <dependency org="org.springframework.security" name="spring-security-web" rev="3.0.4.RELEASE"/>
       <dependency org="org.springframework.security" name="spring-security-taglibs" rev="3.0.4.RELEASE"/>
       <dependency org="org.springframework.security" name="spring-security-core" rev="3.0.4.RELEASE"/>
       <dependency org="org.springframework.security" name="spring-security-config" rev="3.0.4.RELEASE"/>
       <dependency org="org.springframework.security" name="spring-security-acl" rev="3.0.4.RELEASE"/>
       <dependency org="org.springframework" name="spring-instrument-tomcat" rev="3.0.4.RELEASE"/>
       <dependency org="org.springframework" name="spring-jdbc" rev="3.0.4.RELEASE"/>
       <dependency org="org.springframework" name="spring-context-support" rev="3.0.4.RELEASE"/>
       <dependency org="org.springframework" name="spring-orm" rev="3.0.4.RELEASE"/>
       <dependency org="org.springframework" name="spring-jms" rev="3.0.4.RELEASE"/>
       <dependency org="org.springframework" name="spring-aspects" rev="3.0.4.RELEASE"/>
       <dependency org="org.springframework" name="spring-asm" rev="3.0.4.RELEASE"/>
       <dependency org="org.springframework" name="spring-expression" rev="3.0.4.RELEASE"/>
       <dependency org="javax.transaction" name="jta" rev="1.1"/>
       <dependency org="cglib" name="cglib" rev="2.1_3"/>
       <dependency org="dom4j" name="dom4j" rev="1.6.1"/>
       <dependency org="antlr" name="antlr" rev="2.7.6rc1"/>
       <dependency org="org.springframework" name="spring-tx" rev="3.0.4.RELEASE"/>
       <dependency org="org.springframework" name="spring-test" rev="3.0.4.RELEASE"/>
       <dependency org="org.springframework" name="spring-instrument" rev="3.0.4.RELEASE"/>
       <dependency org="org.springframework" name="spring-webmvc-portlet" rev="3.0.4.RELEASE"/>
       <dependency org="org.springframework" name="spring-oxm" rev="3.0.4.RELEASE"/>
        <dependency org="asm" name="asm" rev="3.3.1"/>
        <dependency org="asm" name="asm-attrs" rev="2.2.3"/>
       <dependency org="org.springframework" name="org.springframework.web.servlet" rev="3.0.4.RELEASE" />
       <!-- end -->
        <dependency org="mysql" name="mysql-connector-java" rev="5.1.6" />
        <dependency org="org.hibernate" name="hibernate-core" rev="3.3.1.GA" />
        <dependency org="org.hibernate" name="hibernate-annotations" rev="3.4.0.GA" />
        <dependency org="org.hibernate" name="hibernate-commons-annotations" rev="3.3.0.ga" />
        <dependency org="javax.servlet" name="servlet-api" rev="2.5"/>
        <dependency org="taglibs" name="standard" rev="1.0.6"/>
        <dependency org="javax.servlet" name="jstl" rev="1.2"/>
        <dependency org="commons-lang" name="commons-lang" rev="2.0"/>
         <dependency org="commons-collections" name="commons-collections" rev="3.1"/>
        <dependency org="org.hibernate" name="ejb3-persistence" rev="3.3.2.Beta1"/>
        <dependency org="org.hibernate" name="hibernate-ehcache" rev="4.0.1.Final"/>

    </dependencies>
</ivy-module>

回答1:


I think your issue is that your default resolver is still set to be libraries instead of chained.....

Am I correct in assuming you want to use Maven Central for all dependencies, except those exceptions listed in your modules section? If that is so, then you don't need a chained resolver. The following settings file is much simpler:

<ivysettings>
   <settings defaultCache="${ivy.settings.dir}/ivy-cache" defaultResolver="central"/>
   <resolvers>
      <ibiblio name="central" m2compatible="true"/>

      <filesystem name="local-projects">
         <artifact pattern="${repository.dir}/[artifact]-[revision].[ext]" />
         <ivy pattern="${repository.dir}/[module]-[revision].xml" />
      </filesystem>

      <ibiblio name="spring-releases" m2compatible="true" root="https://oss.sonatype.org/content/repositories/springsource-releases"/> 
   </resolvers>
   <modules>
      <module organisation="com.virtusa" name="dependee" resolver="local-projects"/>
      <module organisation="org.springframework" name="org.springframework.web.servlet" resolver="spring-releases"/>
   </modules> 
</ivysettings>

Note:

  • I've dropped the "usePoms=false" attribute to the Maven central resolver. You're losing one to the main benefits of using a Maven repo. Pulling down dependencies automatically instead of having to reverse engineer other people's builds :-)


来源:https://stackoverflow.com/questions/9426357/apache-ivy-chain-tag

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!