Announcement Announcement Module
Collapse
No announcement yet.
Dependency management with Ivy and Maven repo Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dependency management with Ivy and Maven repo

    This is obviously not the correct forum to post this in, but really no other forum suits it either as far as I can tell. And it's not really an Ivy issue since Ivy works fine for all my other dependencies. Mods, feel free to move as appropriate.

    After struggling for two days trying to get a handle on Spring dependency management using Apache Ivy, I think I'm almost there. I'm using the Maven repository instead of the Spring EBR because when I tried using the EBR it would download like 25 JARs that I did not need. Weird stuff I'd never seen before. Still not sure why.

    So here is my ivy.xml:

    Code:
    ...
    
    	<configurations>
    		<conf name="runtime" />
    	</configurations>
    
    	<dependencies>
    		<dependency org="org.springframework" name="spring-webmvc" rev="${spring.version}" conf="runtime->runtime" />
    		<dependency org="org.springframework" name="spring-orm" rev="${spring.version}" conf="runtime->runtime" />
    		<dependency org="org.springframework" name="spring-oxm" rev="${spring.version}" conf="runtime->runtime" />
    		
    		<exclude org="commons-logging" />
    	</dependencies>
    
    ...
    All of the Spring JARs are getting downloaded, except for three: spring-orm, spring-oxm, and spring-web-servlet. That last one is necessary for my Web project.

    The weird thing is that the log output shows that Ivy is finding the artifacts with no problem:

    Code:
    [ivy:retrieve] 	found org.springframework#spring-webmvc;3.0.5.RELEASE in central
    [ivy:retrieve] 	found org.springframework#spring-asm;3.0.5.RELEASE in central
    [ivy:retrieve] 	found org.springframework#spring-beans;3.0.5.RELEASE in central
    [ivy:retrieve] 	found org.springframework#spring-core;3.0.5.RELEASE in central
    [ivy:retrieve] 	found org.springframework#spring-context;3.0.5.RELEASE in central
    [ivy:retrieve] 	found org.springframework#spring-aop;3.0.5.RELEASE in central
    [ivy:retrieve] 	found aopalliance#aopalliance;1.0 in central
    [ivy:retrieve] 	found org.springframework#spring-expression;3.0.5.RELEASE in central
    [ivy:retrieve] 	found org.springframework#spring-context-support;3.0.5.RELEASE in central
    [ivy:retrieve] 	found org.springframework#spring-web;3.0.5.RELEASE in central
    [ivy:retrieve] 	found org.springframework#spring-orm;3.0.5.RELEASE in central
    [ivy:retrieve] 	found org.springframework#spring-jdbc;3.0.5.RELEASE in central
    [ivy:retrieve] 	found org.springframework#spring-tx;3.0.5.RELEASE in central
    [ivy:retrieve] 	found org.springframework#spring-oxm;3.0.5.RELEASE in central


    But they aren't being downloaded. Does anyone have any ideas? Any help whatsoever would be greatly appreciated! I'm about to pull my hair out...
    Last edited by damrass; Aug 22nd, 2011, 04:06 PM.

  • #2
    Resolved!

    I decided to drop the Maven repo and try the EBR again. I'm posting my setup in hopes of saving others the trouble...

    Here is my updated ivy.settings.xml:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <ivysettings>
    
    	<settings defaultResolver="default" />
    
    	<resolvers>
    		<chain name="default" returnFirst="true">			
    			<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>
    	</resolvers>
    
    </ivysettings>
    And here is my updated ivy.xml:
    Code:
    <ivy-module version="2.0">
    	<info organisation="com.foo" module="bar" />
    
    	<configurations>
    		<conf name="compile" />
    		<conf name="runtime" />
    	</configurations>
    
    	<dependencies>
    		<dependency org="org.springframework" name="org.springframework.web.servlet" rev="3.0.5.RELEASE" conf="compile->runtime" />
    		
    		<exclude artifact="com.springsource.org.apache.commons.logging" />
    	</dependencies>
    </ivy-module>
    Adding the "web.servlet" component as the (only) artifact is sufficient as its transitive dependencies (i.e., the rest of the Spring framework) is automatically retrieved by Ivy. Also, I exclude the commons-logging artifact as recommended in the documentation found here: http://static.springsource.org/sprin...ncy-management

    To browse the EBR (similar to mvnrepository.com), you can go here: http://ebr.springsource.com/repository/app/

    Cheers!

    Comment

    Working...
    X