views:

46

answers:

1

I have been looking at and playing around with IVY of late for a new project. I know that there are two camps on this topic and a lot of reasons people choose one or the other. This question is not focused on that.

What I am interested in is when I use IVY to say get the Spring Frame using the Maven 2 repository I get a Ton of Jar files and then there are issues finding the right version and I have to exclude items etc. Now, if I turn off Poms then I only get the spring framework jar and everything works.

Is there a reason why so many Jar files are delivered through the use of POMs - do these same number of Jar files come if you use a pure Maven solution?


@Pascal_Thivent Here is an update to what I mean.

This is the output that I am getting:

[ivy:retrieve]      ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]      ::          UNRESOLVED DEPENDENCIES         ::
[ivy:retrieve]      ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]      :: javax.ejb#ejb;3.0: not found
[ivy:retrieve]      :: com.oracle#toplink-essentials;2.41: not found
[ivy:retrieve]      :: com.oracle#oc4j;1.0: not found
[ivy:retrieve]      :: jexcelapi#jxl;2.6.6: not found
[ivy:retrieve]      ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve] 
[ivy:retrieve]      ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]      ::              FAILED DOWNLOADS            ::
[ivy:retrieve]      :: ^ see resolution messages for details  ^ ::
[ivy:retrieve]      ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]      :: javax.faces#jsf-api;1.1!jsf-api.jar
[ivy:retrieve]      :: com.bea.wlplatform#commonj-twm;1.1!commonj-twm.jar
[ivy:retrieve]      :: com.oracle.toplink#toplink;10.1.3!toplink.jar
[ivy:retrieve]      :: com.sun.jdmk#jmxtools;1.2.1!jmxtools.jar
[ivy:retrieve]      :: com.sun.jmx#jmxri;1.2.1!jmxri.jar
[ivy:retrieve]      ::::::::::::::::::::::::::::::::::::::::::::::

Here is my ivy.xml

    <dependencies>
    <dependency org="jstl" name="jstl" rev="1.1.2"/>
    <dependency org="commons-logging" name="commons-logging" rev="1.1.1" >
        <exclude org="com.sun.jdmk"/>
        <exclude org="com.sun.jmx"/>
        <exclude org="javax.jms"/>
    </dependency>
    <dependency org="commons-lang" name="commons-lang" rev="2.5">
        <exclude org="com.sun.jdmk"/>
        <exclude org="com.sun.jmx"/>
        <exclude org="javax.jms"/>
    </dependency>
    <dependency org="org.springframework" name="spring" rev="2.5.6"/>
    <dependency org="org.springframework" name="spring-webmvc" rev="2.5.6"/>

</dependencies>

Here is my ivy settings

<ivysettings>
<settings defaultResolver="myChain" />
<resolvers>
    <url name="com.springsource.repository.bundles.release">
        <ivy pattern="http://repository.springsource.com/ivy/bundles/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
        <artifact pattern="http://repository.springsource.com/ivy/bundles/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
    </url>
    <url name="com.springsource.repository.bundles.external">
        <ivy pattern="http://repository.springsource.com/ivy/bundles/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
        <artifact pattern="http://repository.springsource.com/ivy/bundles/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
    </url>

    <chain name="myChain">

        <resolver ref="com.springsource.repository.bundles.release" />
        <resolver ref="com.springsource.repository.bundles.external"/>
        <ibiblio name="jboss" m2compatible="true" root="http://repository.jboss.org/maven2" checkconsistency="false"/>
        <ibiblio name="libraries" m2compatible="true" checkconsistency="false"/>
        <ibiblio name="ilibraries-mirror" m2compatible="true" root="http://mirrors.ibiblio.org/pub/mirrors/maven2/" checkconsistency="false"/>
        <ibiblio name="sun" m2compatible="true" root="http://download.java.net/maven/2/" checkconsistency="false"/>
    </chain>
</resolvers>

+1  A: 

This is a bit a shot in the dark (I don't know what "turn off POMs" means) but my guess is that you are actually getting transitive dependencies (this is simplified but, if A depends on B and if you declare a dependency on A, you'll also get B).

That's one of the features you get when using Maven dependencies and their metadata (the POMs) and a Dependency Management solution like Maven or Ivy. This is a default behavior with Maven and it can't be disabled (there is a meta issue about this, MNG-1977). With Ivy, it looks like it's possible, e.g.:

<dependencies>  
   <dependency org="org.hibernate" name="hibernate-core"
               rev="3.3.1.GA" conf='..'
               transitive="false" /> 
</dependencies>

Is this what you meant?

See also

Pascal Thivent
In the ivysettings.xml you can do the following: <ibiblio name="ibiblio" m2compatible="true" usepoms="false" />
boyd4715
But are all these dependencies necessary or needed? Seems to bloat out my lib directory with jar files that appear to not be required for me to use Spring.
boyd4715
@boyd4715 Ah ok, thanks for the clarification (I think you should mention this kind of details in your question). Regarding the 2nd comment, in general transitive dependencies are required, that's the whole point of declaring them. Maybe you're just not using a part of Spring that would need them. But without a specific example, I can't give a more specific answer.
Pascal Thivent
@Pascal_Thivent - Ok, I understand, so the transitive depended jars are passed along in support of the features provided by, in this example, the spring framework. But, I still end up with issues in which the POMs are not correct on the Maven2 repository - how does someone work around those issues. I am getting issues with some items from SUN.
boyd4715
@boyd4715 Yeah, that's one of the weakness of a dependency management system, it relies on good metadata. And they are not always good. Can you update your question with a specific example of an issue?
Pascal Thivent
@Pascal_Thivent - I have added the output I am seeing from running IVY along with my configuration files.
boyd4715