1
votes

I'm totally new in ivy, so don't blame for for rather elementary questions.

I'm working on project that depends on some libraries of jbossAS 4.0.3. To tell exactly - there are jboss-4.0.3-scheduler, jboss-4.0.3-jboss-system, jboss-4.0.3-jboss, jboss-4.0.3-jbossall-client. So i have a logical question - how can I point ivy to find them on public repository? Or that's the wrong direction of leveraging ivy in this situation?

And another simple question - for example, in the past this project depended on castor-0.9.7, axis-1.3 and log4j - after ivy dependency resolution - I had a lot of other jars like activation-1.1.jar, axis-saaj-1.3.jar, mail-1.4.jar and so on. So it was only 3 jars in dependencies in the past - now I have 10. Do i really need them?
And what is the way to know for sure what do i need of this additional jars?? (after all the project was working with old config - 3 jars).

And what if I have some artifact(dependee project). Other project depends on it, but i don't want transitive dependencies to be resolved. That's only a question of interest ))

This is how i am pulling dependencies now (from local repo), and what i want - to pull them from public repo (if it is possible) :

          <ivy-module version="2.2">
            <info organisation="org.btl" module="BtlAppServer" revision="1.7"/>
            <configurations defaultconfmapping="default">
             <conf name="compile" visibility="private"/>
             <conf name="test" extends="compile" visibility="private"/>
             <conf name="master" />
             <conf name="runtime" extends="compile" />
             <conf name="default" extends="master,runtime"/>
           </configurations>
           <publications>
            <artifact conf="master"/>
           </publications>
           <dependencies>
            <dependencies>
        <dependency org="jboss" name="jboss" rev="4.0.3" conf="*->default" />
        <dependency org="jboss" name="jbossall-client" rev="4.0.3"  
                      conf="*->default"/>
        <dependency org="jboss" name="jboss-system" rev="4.0.3" conf="*->default"/>
        <dependency org="jboss" name="scheduler-plugin" rev="4.0.3" 
                       conf="*->default"/>
        <dependency org="org.btl" name="BtlCommon" rev="latest.integration" />
    </dependencies>
 </ivy-module>

setttings file for this stuff :

    <ivysettings>
      <settings defaultResolver="myChain"/>
       <include url="${ivy.default.settings.dir}/ivysettings-public.xml"/>
      <include url="${ivy.default.settings.dir}/ivysettings-shared.xml"/>
      <include url="${ivy.default.settings.dir}/ivysettings-local.xml"/>
      <include url="${ivy.default.settings.dir}/ivysettings-main-chain.xml"/>
      <include url="${ivy.default.settings.dir}/ivysettings-default-chain.xml"/>
      <resolvers>
        <chain name="myChain" returnFirst="true">
        <resolver ref="local"/>
        <!-- JBoss -->
         <ibiblio name="jboss-nexus" m2compatible="true"
              root="https://repository.jboss.org/nexus/content/groups/developer/"
              pattern="[organisation]/[module]/[revision]/[artifact]-[revision](- 
                 [classifier]).[ext]"/>
        <ibiblio name="ibiblio" m2compatible="true" />
       </chain>
      </resolvers>
       <modules>
        <module organisation='org.btl' resolver='local' />
       </modules>
    </ivysettings>

File ivy.xml for the second question :

 <ivy-module version="2.2">
  <info organisation="org.btl" module="BtlCommon" revision="1.7"/>
  <configurations defaultconfmapping="default">
    <conf name="compile" visibility="private"/>
    <conf name="test" extends="compile" visibility="private"/>
    <conf name="master" />
    <conf name="runtime" extends="compile" />
    <conf name="default" extends="master,runtime"/>
  </configurations>
  <publications>
    <!--get the artifact from our module name-->
    <artifact conf="master"/>
  </publications>

     <dependencies>
        <dependency org="axis" name="axis" rev="1.3" conf="*->default" />
        <dependency org="castor" name="castor" rev="0.9.7" conf="*->default" />
         <dependency org="log4j" name="log4j" rev="1.2.15"   conf="*->default" >
            <exclude org="com.sun.jdmk"/> 
            <exclude org="com.sun.jmx"/>
            <exclude org="javax.jms"/>
        </dependency>
    </dependencies>
 </ivy-module>

Don't know if that can help someway )

1
you can set transitive=false to forbid transitive dependenciesoers
and could you please post your ivy.xml and maybe your ivysettings.xml?oers
the jboss dependency-part seems good, it is the right way to do it. I assume it is working correctly?oers
yes. All is working if the jars in local repo (filesystem). But otherwise - it can't locate them.borzoni

1 Answers

1
votes

The extra jars are produced by transitive dependencies. These may not be needed to compile your project but needed at runtime.

If they are actually needed depends on the dependency itself and your usage of the library. Mail.jar(Java Mail API) for example is only needed if you need to send Mails.

I think it will be quite complicated to really make sure, that you won't need the extra libraries (in the future?). If you are sure now, that you program runs without them, you can just set the transitive attribute to the dependency. And they will not be downloaded.

<dependency org="axis" name="axis" rev="1.3" conf="*->default" transitive="false"/>

I found the Jboss dependencies in the java.net repository for revision="4.2.2.GA". Seems the best option. But I couldn't find the scheduler.

ivysettings.xml

<ibiblio name="jboss-java.net" m2compatible="true"
              root="http://download.java.net/maven/2/"/>