ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd Greenwood-Geer <>
Subject Re: Managing an ivy repository and resolving dependencies
Date Fri, 17 Apr 2009 19:39:01 GMT
Tetyana and Antoine, thank you for your responses.

I'd like to refine my questions to a specific problem: I'm attempting to 
build a repo for a default Grails application. Grails auto-generates the 
app/ivy.xml and the app/ivysettings.xml, which resolve dependencies just 
fine, and the apps compile and run via ant&ivy with no problem.

My approach to building a local repo initially involved taking the 
app/ivy.xml, and migrating the app/ivy.xml:<dependencies...> to my 
repository/build.xml:<ivy:install...> tasks. However, I have found that 
this naive migration resulted in a number of unresolved dependencies, 
and that if I replaced the resolvers in app/ivysettings.xml (which 
resolve to ibiblio, etc.) with resolvers to my local filesystem, then 
ivy would download a significantly smaller subset of the dependencies 
needed by the grails app. Subsequently, the grails app would fail to 
compile or run.

So, my second approach has been to try to generate the local repo 
directly from the app/build.xml, using the original unmodified 
app/ivy.xml and app/ivysettings.xml. With this approach, ivy downloads 
the dependency artifacts to a staging area. Exciting stuff. However, I'm 
a bit stuck w/ respect to publishing. I'll include my targets below, but 
to wrap up, when I publish, only the top level object, my grails app, 
gets published. My goal is to publish not just the top level project (in 
fact, I don't really need this top level), but what I need to publish 
are all the dependencies of this project.

Looking at the docs 
(, I don't 
see anything re: publishing the dependencies of a module. What are my 
options here? Do I need to write some code to walk the directory where 
I'm staging all my dependencies, and publish each one in turn? Or is 
there a cleaner approach?

Here are my some of my artifacts:

#app/ivy.xml // grails generated
<ivy-module version="2.0">
     <info organisation="" module="asmc"/>
         <conf name="build"/>
         <conf name="compile"/>
         <conf name="test" extends="compile"/>
         <conf name="runtime" extends="compile"/>
         <dependency org="org.grails" name="grails-bootstrap" 
rev="1.1-RC2" conf="build"/>
         <dependency org="org.grails" name="grails-scripts" 
rev="1.1-RC2" conf="build"/>
         <dependency org="org.grails" name="grails-gorm" rev="1.1-RC2" 
         <dependency org="org.grails" name="grails-web" rev="1.1-RC2" 
         <dependency org="org.grails" name="grails-test" rev="1.1-RC2" 
         <dependency org="org.slf4j" name="slf4j-log4j12" rev="1.5.5" 
         <dependency org="opensymphony" name="oscache" rev="2.4" 
             <exclude org="javax.jms" module="jms" name="*" type="*" 
ext="*" conf="" matcher="exact"/>
             <exclude org="commons-logging" module="commons-logging" 
name="*" type="*" ext="*" conf="" matcher="exact"/>
             <exclude org="javax.servlet" module="servlet-api" name="*" 
type="*" ext="*" conf="" matcher="exact"/>
         <dependency org="hsqldb" name="hsqldb" rev="" 
         <dependency org="mysql" name="mysql-connector-java" rev="5.1.6" 
         <dependency org="mysql" name="mysql-connector-java" rev="5.1.6" 
         <dependency org="postgresql" name="postgresql" 
rev="8.3-603.jdbc3" conf="runtime"/>

#app/build.xml // my custom tasks for dependency publishing

     <!-- =================================
           target: resolve and publish dependencies to staging repository
          ================================= -->
     <target name="-resolve-deps-to-staging" description="--> Resolve 
application dependencies to staging repository" depends="init-ivy">

     <!-- =================================
           target: publish dependencies from staging repository to repo
          ================================= -->
     <target name="publish" description="--> Publish application 
dependencies from staging to repository" depends="-resolve-deps-to-staging">
         <ivy:publish resolver="foo-repo" pubrevision="1.0">

#repo/staging // subset of what gets downloaded
find xpp3/

#repo/staging // subset of what gets downloaded
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="1.0" xmlns:m="">
	<info organisation="xpp3"
		MXP1 is a stable XmlPull parsing engine that is based on ideas from 
XPP and in particular XPP2 but completely revised and rewritten to take 
the best advantage of latest JIT JVMs such as Hotspot in JDK 1.4+.
		<conf name="default" visibility="public" description="runtime 
dependencies and master artifact can be used with this conf" 
		<conf name="master" visibility="public" description="contains only the 
artifact published by this module itself, with no transitive dependencies"/>
		<conf name="compile" visibility="public" description="this is the 
default scope, used if none is specified. Compile dependencies are 
available in all classpaths."/>
		<conf name="provided" visibility="public" description="this is much 
like compile, but indicates you expect the JDK or a container to provide 
it. It is only available on the compilation classpath, and is not 
		<conf name="runtime" visibility="public" description="this scope 
indicates that the dependency is not required for compilation, but is 
for execution. It is in the runtime and test classpaths, but not the 
compile classpath." extends="compile"/>
		<conf name="test" visibility="private" description="this scope 
indicates that the dependency is not required for normal use of the 
application, and is only available for the test compilation and 
execution phases." extends="runtime"/>
		<conf name="system" visibility="public" description="this scope is 
similar to provided except that you have to provide the JAR which 
contains it explicitly. The artifact is always available and is not 
looked up in a repository."/>
		<conf name="sources" visibility="public" description="this 
configuration contains the source artifact of this module, if any."/>
		<conf name="javadoc" visibility="public" description="this 
configuration contains the javadoc artifact of this module, if any."/>
		<conf name="optional" visibility="public" description="contains all 
optional dependencies"/>
		<artifact name="xpp3_min" type="jar" ext="jar" conf="master"/>

Again, thank you for your time.

View raw message