ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd Greenwood-Geer <t.greenwoodg...@gmail.com>
Subject Re: Managing an ivy repository and resolving dependencies : Bug?
Date Mon, 20 Apr 2009 22:13:05 GMT
Perhaps this is a bug in ivy...

After publishing (ivy:publish) the grails app to a local staging 
repository, I try to install (ivy:install) the grails app from the 
staging repository, to a more permanent local repository. However, the 
install fails as the task thinks that there are no dependencies. I'll 
paste in the relevant logs, and as this is a simple test app, I'd be 
happy to email it to anyone that is interested.

Repositories
------------

./xivy-test/repo/staging
./xivy-test/repo/current

REPRO
-----
1. ./xivy-test/app $ ant publish

 >> this resolves, compiles, and publishes the grails app to staging

2. ./xivy-test/repo $ ant intstall

 >> this finds the grails app and installs it into current, but it fails 
to find any dependencies...but if you look at the app/ivy.xml file, you 
can see that there are 8 declared dependencies...and that's not counting 
any of their transitive dependencies...


Output
------

[ivy:install] :: install resolution report ::
Finding class org.apache.ivy.core.cache.DefaultResolutionCacheManager
Loaded from /home/toddg/working/xivy-test/.ivy/lib/ivy-2.1.0-rc1.jar 
org/apache/ivy/core/cache/DefaultResolutionCacheManager.class
Class org.apache.ivy.core.cache.DefaultResolutionCacheManager loaded 
from ant loader (parentFirst)
Class java.io.FilenameFilter loaded from parent loader (parentFirst)
[ivy:install] :: resolution report :: resolve 0ms :: artifacts dl 2ms
	---------------------------------------------------------------------
	|                  |            modules            ||   artifacts   |
	|       conf       | number| search|dwnlded|evicted|| number|dwnlded|
	---------------------------------------------------------------------
	|      default     |   1   |   0   |   0   |   0   ||   1   |   0   |
	---------------------------------------------------------------------
Class java.io.PrintWriter loaded from parent loader (parentFirst)
[ivy:install] Nbr of module to sort : 1
[ivy:install] Sort dependencies of : org.example#app;0.1 / Number of 
dependencies = 0
[ivy:install] Sort done for : org.example#app;0.1
Finding class org.apache.ivy.core.module.descriptor.License
Loaded from /home/toddg/working/xivy-test/.ivy/lib/ivy-2.1.0-rc1.jar 
org/apache/ivy/core/module/descriptor/License.class
Class org.apache.ivy.core.module.descriptor.License loaded from ant 
loader (parentFirst)
[ivy:install] 	report for apache#ivy-install;1.0 default produced in 
/home/toddg/working/xivy-test/.ivy/cache/apache-ivy-install-default.xml
Finding class org.apache.ivy.util.MessageLoggerHelper
Loaded from /home/toddg/working/xivy-test/.ivy/lib/ivy-2.1.0-rc1.jar 
org/apache/ivy/util/MessageLoggerHelper.class
Class org.apache.ivy.util.MessageLoggerHelper loaded from ant loader 
(parentFirst)



Ivy files (pasted below)
------------------------

./xivy-test/
	ivy-common.xml

./xivy-test/app/
		build.xml
		ivy.xml
		ivysettings.xml

./xivy-test/repo/
		build.xml

./xivy-test/repo/settings/
			asi-settings.xml


# ----------------------------------------------
# ivy-common.txt
# ----------------------------------------------

<?xml version="1.0"?>

<!-- ======================================================================
      Common Ivy Tasks
 
====================================================================== -->

<project xmlns:ivy="antlib:org.apache.ivy.ant" name="ivy-common" 
default="test" basedir=".">

     <!--
     ==============================================
     Common Ivy Properties
     ==============================================-->

     <property environment="env"/>

     <!-- set the basedir for this (included) file -->
     <dirname property="ivy-common.basedir" file="${ant.file.ivy-common}"/>

     <!-- set teh versions -->
   	<property name="ivy.install.version" value="2.0.0" />
     <condition property="ivy.home" value="${env.IVY_HOME}">
       <isset property="env.IVY_HOME" />
     </condition>

     <!-- set the ivy home dirs -->
     <property name="ivy.home" value="${ivy-common.basedir}/.ivy" />
     <property name="ivy.cache.dir" value="${ivy.home}/cache" />
     <property name="ivy.jar.dir" value="${ivy.home}/lib" />
     <property name="ivy.jar.file" 
value="${ivy.jar.dir}/ivy-${ivy.install.version}.jar" />

     <!-- repository settings -->
     <property name="asi.repo.home" value="${ivy-common.basedir}/repo"/>
     <property name="asi.repo.dir" value="${asi.repo.home}/current"/>
     <property name="asi.repo.staging.dir" 
value="${asi.repo.home}/staging"/>
     <property name="asi.repo.bootstrap.dir" 
value="${asi.repo.home}/bootstrap"/>

     <!--
     ==============================================
     Debug Properties
     ==============================================-->
     <target name="-debug">
         <echo message="ivy-common.basedir = ${ivy-common.basedir}"/>
         <echo message="ivy.home = ${ivy.home}"/>
         <echo message="ivy.cache.dir = ${ivy.cache.dir}"/>
         <echo message="ivy.jar.dir = ${ivy.jar.dir}"/>
         <echo message="ivy.jar.file = ${ivy.jar.file}"/>

         <echo message="asi.repo.home = ${asi.repo.home}"/>
         <echo message="asi.repo.dir = ${asi.repo.dir}"/>
         <echo message="asi.repo.staging.dir = ${asi.repo.staging.dir}"/>
         <echo message="asi.repo.bootstrap.dir = 
${asi.repo.bootstrap.dir}"/>
     </target>

     <!--
     ==============================================
     Ivy Targets
     ==============================================-->
     <target name="download-ivy" unless="offline">
		<available file="${ivy.jar.file}" property="ivy.installed"/>
		<antcall target="-download-ivy" />
     </target>

	<target name="-download-ivy" unless="ivy.installed">
         <echo message="unzipping ivy.zip from ${asi.repo.bootstrap.dir} 
to ${ivy.jar.dir}"/>
         <mkdir dir="${ivy.jar.dir}"/>
         <!-- unzip the ivy file from the repo -->

	    <unzip 
src="${asi.repo.bootstrap.dir}/apache-ivy-2.1.0-rc1-bin-with-deps.zip" 
dest="${ivy.jar.dir}">
		   <patternset>
		        <include name="**/*.jar"/>
		    </patternset>
			<mapper type="flatten"/>
		</unzip>
	</target>

     <target name="init-ivy" depends="-debug, download-ivy" 
unless="ivy.lib.path">
       <!-- try to load ivy here from ivy home, in case the user has not 
already dropped
               it into ant's lib dir (note that the latter copy will 
always take precedence).
               We will not fail as long as local lib dir exists (it may 
be empty) and
               ivy is in at least one of ant's lib dir or the local lib 
dir. -->
         <path id="ivy.lib.path">
             <fileset dir="${ivy.jar.dir}" includes="*.jar"/>
         </path>
         <taskdef resource="org/apache/ivy/ant/antlib.xml"
                  uri="antlib:org.apache.ivy.ant" 
classpathref="ivy.lib.path"/>
     </target>
</project>

# ----------------------------------------------
# app/build.xml
# ----------------------------------------------
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="app" default="test" 
basedir=".">

     <!--
     Notes:
 
http://swik.net/Hibernate/Hibernate+GroupBlog/Managing+the+dependencies+of+a+seam-gen+project+with+Ivy/cgmmf
     -->

     <import file="../ivy-common.xml"/>

     <property name="lib.dir" value="${basedir}/lib"/>

     <macrodef name="grails">
         <attribute name="script"/>
         <attribute name="args" default="" />
         <sequential>
             <grailsTask script="@{script}" args="@{args}" 
classpathref="grails.classpath">
                 <compileClasspath refid="compile.classpath"/>
                 <testClasspath refid="test.classpath"/>
                 <runtimeClasspath refid="app.classpath"/>
             </grailsTask>
         </sequential>
     </macrodef>

     <!-- =================================
           target: resolve
          ================================= -->
     <target name="-resolve" description="--> Retrieve dependencies with 
ivy" depends="init-ivy">
         <ivy:retrieve 
pattern="${lib.dir}/[conf]/[artifact]-[revision].[ext]"/>
     </target>

     <target name="-init-grails" depends="-resolve">
         <path id="grails.classpath">
             <fileset dir="${lib.dir}/build"/>
         </path>

         <path id="compile.classpath">
             <fileset dir="${lib.dir}/compile"/>
         </path>

         <path id="test.classpath">
             <fileset dir="${lib.dir}/test"/>
         </path>

         <path id="app.classpath">
             <fileset dir="${lib.dir}/runtime"/>
         </path>

         <taskdef name="grailsTask"
                  classname="grails.ant.GrailsTask"
                  classpathref="grails.classpath"/>
     </target>

     <target name="deps-report" depends="-resolve" description="--> 
Generate report of module dependencies.">
         <ivy:report conf="*"/>
     </target>

     <!-- =================================
           target: clean
          ================================= -->
     <target name="clean" depends="-init-grails" description="--> Cleans 
a Grails application">
         <grails script="Clean"/>
         <delete dir="${lib.dir}" includes="**/*"/>
     </target>

     <!-- =================================
           target: compile
          ================================= -->
     <target name="compile" depends="-init-grails" description="--> 
Compiles a Grails application">
         <grails script="Compile"/>
     </target>

     <!-- =================================
           target: war
          ================================= -->
     <target name="war" depends="-init-grails" description="--> Creates 
a WAR of a Grails application">
         <grails script="War"/>
     </target>

     <!-- =================================
           target: test
          ================================= -->
     <target name="test" depends="-init-grails" description="--> Run a 
Grails applications unit tests">
         <grails script="TestApp"/>
     </target>

     <!-- =================================
           target: run
          ================================= -->
     <target name="run" depends="-init-grails" description="--> Runs a 
Grails application using embedded Jetty">
         <grails script="RunApp"/>
     </target>

     <!-- =================================
           target: deploy
          ================================= -->
     <target name="deploy" depends="war" description="--> The deploy 
target (initially empty)">
         <!-- TODO -->
     </target>

     <!--
     ==============================================
     Grails Targets For Ivy publishing
     ==============================================-->

     <!-- =================================
           target: -stage-clean
          ================================= -->
     <target name="stage-clean" >
         <delete dir="${asi.repo.staging.dir}" />
     </target>

     <!-- =================================
           target: resolve and publish dependencies to staging repository
          ================================= -->
     <target name="resolve-deps" description="--> Resolve application 
dependencies to staging repository" depends="stage-clean, compile">
         <!-- retrieve the dependencies for the current module into the 
staging area -->
         <ivy:retrieve
             sync="true"
 
pattern="${asi.repo.staging.dir}/asi/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"
 
ivypattern="${asi.repo.staging.dir}/asi/[organisation]/[module]/ivys/ivy-[revision].xml"
         />
     </target>

     <!-- =================================
           target: publish dependencies from staging repository to repo
          ================================= -->
     <target name="publish" description="--> Publish application 
dependencies from staging to repository" depends="resolve-deps">
         <!-- publish the dependencies for the current module, that are 
in the artifacts dir, to the target resolver, 'asi-repo' -->
         <ivy:publish
                 resolver="staging-repo"
                 overwrite="true"
                 pubrevision="0.1"
                 forcedeliver="true"
                 update="true"
                 publishivy="true"
                 validate="true"
                 >
             <!-- artifacts are the objects to publish to the target 
repository -->
             <artifacts 
pattern="${asi.repo.staging.dir}/asi/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
             <artifacts 
pattern="${asi.repo.staging.dir}/asi/[organisation]/[module]/ivys/ivy-[revision].xml"/>
         </ivy:publish>
     </target>

</project>
# ----------------------------------------------
# app/ivy.xml
# ----------------------------------------------
<ivy-module version="2.0">
     <info organisation="org.example" module="app"/>
     <configurations 
defaultconfmapping="build->default;compile->compile(*),master(*);test,runtime->runtime(*),master(*)">
         <conf name="build"/>
         <conf name="compile"/>
         <conf name="test" extends="compile"/>
         <conf name="runtime" extends="compile"/>
     </configurations>
     <dependencies>
         <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" 
conf="compile"/>
         <dependency org="org.grails" name="grails-web" rev="1.1-RC2" 
conf="compile"/>
         <dependency org="org.grails" name="grails-test" rev="1.1-RC2" 
conf="test"/>
         <dependency org="org.slf4j" name="slf4j-log4j12" rev="1.5.5" 
conf="runtime"/>
         <dependency org="opensymphony" name="oscache" rev="2.4" 
conf="runtime">
             <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>
         <dependency org="hsqldb" name="hsqldb" rev="1.8.0.5" 
conf="runtime"/>
         <!--
         <dependency org="mysql" name="mysql-connector-java" rev="5.1.6" 
conf="runtime"/>
         <dependency org="postgresql" name="postgresql" 
rev="8.3-603.jdbc3" conf="runtime"/>
         -->
     </dependencies>
</ivy-module>
# ----------------------------------------------
# app/ivysettings.xml
# ----------------------------------------------
<!-- original settings -->
<ivysettings>
   <settings defaultResolver="codehaus-plus"/>
   <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"/>
     <namespaces>
     	<namespace name="maven2">
	        <rule>	<!-- imported apache maven1 projects -->
             	<fromsystem>
                 	<src org="apache" module=".+"/>
	
                     <dest org="$m0" module="$m0"/>
                 </fromsystem>
                 <tosystem>
					<src org="commons-.+" module="commons-.+" />
					<src org="ant" module=".*" />
					<src org="avalon-.+" module="avalon-.+" />
					<src org="avalon" module="avalon" />
					<src org="axis" module="axis" />
					<src org="axis2" module="axis2" />
					<src org="batik" module="batik" />
					<src org="bcel" module="bcel" />
					<src org="beehive" module="beehive" />
					<src org="bsf" module="bsf" />
					<src org="cactus" module="cactus" />
					<src org="cocoon" module="cocoon" />
					<src org="cornerstone-.+" module="cornerstone-.+" />
					<src org="create-checksums" module="create-checksums" />
					<src org="crimson" module="crimson" />
					<src org="directory-.+" module="directory-.+" />
					<src org="directory" module="directory" />
					<src org="ecs" module="ecs" />
					<src org="excalibur-.+" module="excalibur-.+" />
					<src org="excalibur" module="excalibur" />
					<src org="fop" module="fop" />
					<src org="fulcrum" module="fulcrum" />
					<src org="geronimo-.+" module="geronimo-.+" />
					<src org="geronimo" module="geronimo" />
					<src org="hivemind" module="hivemind" />
					<src org="jakarta-regexp" module="jakarta-regexp" />
					<src org="james" module="james" />
					<src org="jaxme" module="jaxme" />
					<src org="jcs-javagroups" module="jcs-javagroups" />
					<src org="jcs" module="jcs" />
					<src org="jspapi" module="jspapi" />
					<src org="jstl" module="jstl" />
					<src org="juddi" module="juddi" />
					<src org="log4j" module="log4j" />
					<src org="logkit" module="logkit" />
					<src org="lucene" module="lucene" />
					<src org="magicGball" module="magicGball" />
					<src org="maven" module="maven" />
					<src org="merlin-developer" module="merlin-developer" />
					<src org="merlin" module="merlin" />
					<src org="muse" module="muse" />
					<src org="myfaces" module="myfaces" />
					<src org="nekohtml" module="nekohtml" />
					<src org="ojb" module="ojb" />
					<src org="oro" module="oro" />
					<src org="pluto-container" module="pluto-container" />
					<src org="poi" module="poi" />
					<src org="pubscribe" module="pubscribe" />
					<src org="sandesha" module="sandesha" />
					<src org="servletapi" module="servletapi" />
					<src org="slide" module=".*" />
					<src org="stratum" module="stratum" />
					<src org="struts" module="struts" />
					<src org="taglibs" module="taglibs" />
					<src org="tapestry" module="tapestry" />
					<src org="tomcat-util" module="tomcat-util" />
					<src org="tomcat" module="tomcat" />
					<src org="torque" module="torque" />
					<src org="turbine" module="turbine" />
					<src org="velocity-.+" module="velocity-.+" />
					<src org="velocity" module="velocity" />
					<src org="ws-commons.*" module="ws-commons.*" />
					<src org="wsdl4j" module="wsdl4j" />
					<src org="wsrf" module="wsrf" />
					<src org="xalan" module="xalan" />
					<!-- <src org="xerces" module=".*" /> -->
					<src org="xercesjarv" module="xercesjarv" />
					<src org="xml-apis" module="xml-apis" />
					<src org="xml-resolver" module="xml-resolver" />
					<src org="xml-security" module="xml-security" />
					<src org="xmlbeans" module="xmlbeans" />
					<src org="xmlrpc" module="xmlrpc" />
					
					<dest org="apache" module="$m0"/>
             	</tosystem>
         	</rule>

			<rule> <!-- new apache projects -->
	    		<fromsystem>
		        	<src org="apache" />
         			<dest org="org.apache"/>
		    	</fromsystem>
			    <tosystem>
     		    	<src org="org.apache" />
	    		    <dest org="apache" />
		    	</tosystem>
			</rule>
			<rule> <!-- hibernate -->
	    		<fromsystem>
		        	<src org="hibernate" />
         			<dest org="org.hibernate"/>
		    	</fromsystem>
			    <tosystem>
     		    	<src org="org.hibernate" />
	    		    <dest org="hibernate" />
		    	</tosystem>
			</rule>
			<rule> <!-- net.sf projects -->
	    		<fromsystem>
		        	<src org="ehcache" />
         			<dest org="net.sf.$o0"/>
		    	</fromsystem>
			    <tosystem>
     		    	<src org="net.sf.(.+)" />
	    		    <dest org="$o1" />
		    	</tosystem>
			</rule>
     	</namespace>
	</namespaces>


   <resolvers>
     <!-- original resolver -->
     <chain name="codehaus-plus" dual="true">
       <ibiblio name="codehaus-snapshots" 
root="http://snapshots.repository.codehaus.org" m2compatible="true" 
changingPattern=".*SNAPSHOT"/>
       <ibiblio name="codehaus" root="http://repository.codehaus.org" 
m2compatible="true"/>
       <ibiblio name="javanet" root="http://download.java.net/maven/2/" 
m2compatible="true"/>
       <resolver ref="public"/>
     </chain>


     <!-- for pushing/pulling data to/from the local repository -->
     <filesystem name="asi-repo">
         <artifact 
pattern="${asi.repo.dir}/asi/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
     </filesystem>

     <!-- for pulling data from the staging repository to be published 
to the local repository -->
     <filesystem name="staging-repo" >
         <artifact 
pattern="${asi.repo.staging.dir}/asi/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
     </filesystem>

   </resolvers>
</ivysettings>

<!-- local only settings
<ivysettings>
   <settings defaultResolver="local-only"/>
   <resolvers>
     <chain name="local-only">
       <filesystem name="asi-repo">
         <artifact 
pattern="${asi.repo.dir}/asi/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
       </filesystem>
     </chain>
   </resolvers>
</ivysettings>
  -->

# ----------------------------------------------
# repo/build.xml
# ----------------------------------------------
<?xml version="1.0"?>

<!-- ======================================================================
      Ivy Repo Manager
 
====================================================================== -->

<project name="asi-ivy-repository" default="install" 
xmlns:ivy="antlib:org.apache.ivy.ant" basedir=".">

     <!--
     ==============================================
     Common Ivy Stuff
     ==============================================-->

     <import file="../ivy-common.xml"/>

     <!--
     ==============================================
     Local Ivy Repo Properties
     ==============================================-->

     <!-- settings  -->
	<property name="settings.dir" value="settings"/>
	

     <!--
     ==============================================
     Targets
     ==============================================-->

     <!-- =================================
          init-ivy : download and unzip if not present
          ================================= -->
     <target name="init-ivy" depends="ivy-common.init-ivy">
        	<ivy:settings id="asi.settings" 
file="${settings.dir}/asi-settings.xml"/>
     </target>


     <!-- =================================
          install : install dependencies to build this project in the repo
          ================================= -->
     <target name="install" depends="init-ivy"
     	description="--> Install com.asi.asmc module dependencies">
     	
         <ivy:install
             organisation="org.example"
             module="app"
             revision="0.1"
             settingsRef="asi.settings"
             from="staging-repo"
             to="asi-repo"
             overwrite="true"
             haltonfailure="true"
             validate="true"
             transitive="true"
         />

     <!--
     <target name="install" depends="init-ivy"
     	description=" Install com.asi.asmc module dependencies the local 
asi repo. Note: this task evaluates the published com.asi.asmc module, 
and then takes actual artifacts from the user cache *and* external repos 
and pushes into the local repo.">
     	
         <ivy:install
             organisation="com.asi"
             module="asmc"
             revision="1.0"
             settingsRef="asi.settings"
             from="${from.resolver}"
             to="${to.resolver}"
             transitive="true"
             overwrite="${ivy.install.overwrite}"
             haltonfailure="${ivy.install.haltonfailure}"
         />
     -->

</target>

	<!-- =================================
           target: clean-cache
          ================================= -->
     <target name="clean-cache" depends="init-ivy" description="--> 
clean the cache">
     	<ivy:cleancache settingsRef="asi.settings" />
     	<delete dir="${ivy.cache.dir}" failonerror="true"  />
         <mkdir dir="${ivy.cache.dir}" />
     </target>
	
     <!-- =================================
           target: delete-repo
          ================================= -->
     <target name="delete-repo" depends="init-ivy" description="--> 
delete the repository!!!">
     	<ivy:cleancache settingsRef="asi.settings" />
     	<delete dir="${asi.repo.dir}" failonerror="true"  />
         <mkdir dir="${asi.repo.dir}" />
     </target>
</project>

# ----------------------------------------------
# repo/staging/asi-settings.xml
# ----------------------------------------------
#
<ivysettings>
   <settings
             defaultResolver="external-resolvers"
             defaultCache="${ivy.cache.dir}"
             defaultConflictManager="all" />		<!-- in order to get all 
revisions without any eviction -->

   <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"/>
	
     <namespaces>
     	<namespace name="maven2">
	        <rule>	<!-- imported apache maven1 projects -->
             	<fromsystem>
                 	<src org="apache" module=".+"/>
	
                     <dest org="$m0" module="$m0"/>
                 </fromsystem>
                 <tosystem>
					<src org="commons-.+" module="commons-.+" />
					<src org="ant" module=".*" />
					<src org="avalon-.+" module="avalon-.+" />
					<src org="avalon" module="avalon" />
					<src org="axis" module="axis" />
					<src org="axis2" module="axis2" />
					<src org="batik" module="batik" />
					<src org="bcel" module="bcel" />
					<src org="beehive" module="beehive" />
					<src org="bsf" module="bsf" />
					<src org="cactus" module="cactus" />
					<src org="cocoon" module="cocoon" />
					<src org="cornerstone-.+" module="cornerstone-.+" />
					<src org="create-checksums" module="create-checksums" />
					<src org="crimson" module="crimson" />
					<src org="directory-.+" module="directory-.+" />
					<src org="directory" module="directory" />
					<src org="ecs" module="ecs" />
					<src org="excalibur-.+" module="excalibur-.+" />
					<src org="excalibur" module="excalibur" />
					<src org="fop" module="fop" />
					<src org="fulcrum" module="fulcrum" />
					<src org="geronimo-.+" module="geronimo-.+" />
					<src org="geronimo" module="geronimo" />
					<src org="hivemind" module="hivemind" />
					<src org="jakarta-regexp" module="jakarta-regexp" />
					<src org="james" module="james" />
					<src org="jaxme" module="jaxme" />
					<src org="jcs-javagroups" module="jcs-javagroups" />
					<src org="jcs" module="jcs" />
					<src org="jspapi" module="jspapi" />
					<src org="jstl" module="jstl" />
					<src org="juddi" module="juddi" />
					<src org="log4j" module="log4j" />
					<src org="logkit" module="logkit" />
					<src org="lucene" module="lucene" />
					<src org="magicGball" module="magicGball" />
					<src org="maven" module="maven" />
					<src org="merlin-developer" module="merlin-developer" />
					<src org="merlin" module="merlin" />
					<src org="muse" module="muse" />
					<src org="myfaces" module="myfaces" />
					<src org="nekohtml" module="nekohtml" />
					<src org="ojb" module="ojb" />
					<src org="oro" module="oro" />
					<src org="pluto-container" module="pluto-container" />
					<src org="poi" module="poi" />
					<src org="pubscribe" module="pubscribe" />
					<src org="sandesha" module="sandesha" />
					<src org="servletapi" module="servletapi" />
					<src org="slide" module=".*" />
					<src org="stratum" module="stratum" />
					<src org="struts" module="struts" />
					<src org="taglibs" module="taglibs" />
					<src org="tapestry" module="tapestry" />
					<src org="tomcat-util" module="tomcat-util" />
					<src org="tomcat" module="tomcat" />
					<src org="torque" module="torque" />
					<src org="turbine" module="turbine" />
					<src org="velocity-.+" module="velocity-.+" />
					<src org="velocity" module="velocity" />
					<src org="ws-commons.*" module="ws-commons.*" />
					<src org="wsdl4j" module="wsdl4j" />
					<src org="wsrf" module="wsrf" />
					<src org="xalan" module="xalan" />
					<!-- <src org="xerces" module=".*" /> -->
					<src org="xercesjarv" module="xercesjarv" />
					<src org="xml-apis" module="xml-apis" />
					<src org="xml-resolver" module="xml-resolver" />
					<src org="xml-security" module="xml-security" />
					<src org="xmlbeans" module="xmlbeans" />
					<src org="xmlrpc" module="xmlrpc" />
					
					<dest org="apache" module="$m0"/>
             	</tosystem>
         	</rule>

			<rule> <!-- new apache projects -->
	    		<fromsystem>
		        	<src org="apache" />
         			<dest org="org.apache"/>
		    	</fromsystem>
			    <tosystem>
     		    	<src org="org.apache" />
	    		    <dest org="apache" />
		    	</tosystem>
			</rule>
			<rule> <!-- hibernate -->
	    		<fromsystem>
		        	<src org="hibernate" />
         			<dest org="org.hibernate"/>
		    	</fromsystem>
			    <tosystem>
     		    	<src org="org.hibernate" />
	    		    <dest org="hibernate" />
		    	</tosystem>
			</rule>
			<rule> <!-- net.sf projects -->
	    		<fromsystem>
		        	<src org="ehcache" />
         			<dest org="net.sf.$o0"/>
		    	</fromsystem>
			    <tosystem>
     		    	<src org="net.sf.(.+)" />
	    		    <dest org="$o1" />
		    	</tosystem>
			</rule>
     	</namespace>
	</namespaces>

   <resolvers>

     <chain name="external-resolvers" dual="true">
       <!-- populate the local repo from the net using the same settings 
as a default grails app -->
       <ibiblio name="codehaus-snapshots" 
root="http://snapshots.repository.codehaus.org" m2compatible="true" 
changingPattern=".*SNAPSHOT"/>
       <ibiblio name="codehaus" root="http://repository.codehaus.org" 
m2compatible="true"/>
       <ibiblio name="javanet" root="http://download.java.net/maven/2/" 
m2compatible="true"/>
       <resolver ref="public"/>
     </chain>

     <!-- for pushing/pulling data to/from the local repository -->
     <filesystem name="asi-repo" >
         <artifact 
pattern="${asi.repo.dir}/asi/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
     </filesystem>

     <!-- for pulling data from the staging repository to be published 
to the local repository -->
     <filesystem name="staging-repo" >
         <artifact 
pattern="${asi.repo.staging.dir}/asi/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
     </filesystem>

     <!-- current contains the deployed app, and staging contains the 
dependencies -->
     <chain name="current-and-staging-repo" dual="true">
             <filesystem name="asi-repo" >
                 <artifact 
pattern="${asi.repo.dir}/asi/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
             </filesystem>
             <filesystem name="staging-repo">
                 <artifact 
pattern="${asi.repo.staging.dir}/asi/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
             </filesystem>
     </chain>

   </resolvers>
</ivysettings>	

Todd Greenwood-Geer wrote:
> 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 
> (http://ant.apache.org/ivy/history/2.1.0-rc1/use/publish.html), 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="org.foo" module="asmc"/>
>     <configurations 
> defaultconfmapping="build->default;compile->compile(*),master(*);test,runtime->runtime(*),master(*)">

> 
>         <conf name="build"/>
>         <conf name="compile"/>
>         <conf name="test" extends="compile"/>
>         <conf name="runtime" extends="compile"/>
>     </configurations>
>     <dependencies>
>         <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" 
> conf="compile"/>
>         <dependency org="org.grails" name="grails-web" rev="1.1-RC2" 
> conf="compile"/>
>         <dependency org="org.grails" name="grails-test" rev="1.1-RC2" 
> conf="test"/>
>         <dependency org="org.slf4j" name="slf4j-log4j12" rev="1.5.5" 
> conf="runtime"/>
>         <dependency org="opensymphony" name="oscache" rev="2.4" 
> conf="runtime">
>             <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>
>         <dependency org="hsqldb" name="hsqldb" rev="1.8.0.5" 
> conf="runtime"/>
>         <dependency org="mysql" name="mysql-connector-java" rev="5.1.6" 
> conf="runtime"/>
>         <!--
>         <dependency org="mysql" name="mysql-connector-java" rev="5.1.6" 
> conf="runtime"/>
>         <dependency org="postgresql" name="postgresql" 
> rev="8.3-603.jdbc3" conf="runtime"/>
>         -->
>     </dependencies>
> </ivy-module>
> 
> #===============================================
> #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">
>         <ivy:retrieve
> 
> pattern="${foo.repo.staging.dir}/foo/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"

> 
> 
> ivypattern="${foo.repo.staging.dir}/foo/[organisation]/[module]/ivys/ivy-[revision].xml"

> 
>         />
>     </target>
> 
>     <!-- =================================
>           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">
>             <artifacts 
> pattern="${foo.repo.staging.dir}/foo/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>

> 
>             <artifacts 
> pattern="${foo.repo.staging.dir}/foo/[organisation]/[module]/ivys/ivy-[revision].xml"/>

> 
>         </ivy:publish>
>     </target>
> 
> #===============================================
> #repo/staging // subset of what gets downloaded
> #===============================================
> toddg@LAPTOP:~/src/Main/FOO/etc/project/main/foo-ivy-repo/staging/foo$ 
> find xpp3/
> xpp3/
> xpp3/xpp3_min
> xpp3/xpp3_min/ivys
> xpp3/xpp3_min/ivys/ivy-1.1.3.4.O.xml
> xpp3/xpp3_min/jars
> xpp3/xpp3_min/jars/xpp3_min-1.1.3.4.O.jar
> 
> #===============================================
> #repo/staging // subset of what gets downloaded
> #===============================================
> <?xml version="1.0" encoding="UTF-8"?>
> <ivy-module version="1.0" xmlns:m="http://ant.apache.org/ivy/maven">
>     <info organisation="xpp3"
>         module="xpp3_min"
>         revision="1.1.3.4.O"
>         status="release"
>         publication="20060218133216"
>     >
>         <description 
> homepage="http://www.extreme.indiana.edu/xgws/xsoap/xpp/mxp1/">
>         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+.
>         </description>
>     </info>
>     <configurations>
>         <conf name="default" visibility="public" description="runtime 
> dependencies and master artifact can be used with this conf" 
> extends="runtime,master"/>
>         <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 transitive."/>
>         <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"/>
>     </configurations>
>     <publications>
>         <artifact name="xpp3_min" type="jar" ext="jar" conf="master"/>
>     </publications>
> </ivy-module>
> 
> Again, thank you for your time.
> -Todd

Mime
View raw message