You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-user@ant.apache.org by Todd Greenwood-Geer <t....@gmail.com> on 2009/04/17 02:01:05 UTC
Managing an ivy repository and resolving dependencies
Hi,
I'm very interested in apache ivy and the benefits it provides. However,
I'm having some problems...I apologize in advance for the lengthy email.
Questions are labeled "Q[0-9]:" below:
I've created an ivy repository, but I'm having difficulties as some of
the dependencies are not resolving. For example, here it looks as though
I'm attempting to install ant 1.7.1, however, it is failing because
xercesImpl 2.9.0 is not resolving.
=============================================
Q1: is that a correct assessment of this log?
(more questions below...)
=============================================
[ivy:install] :: installing org.apache.ant#ant;1.7.1 ::
[ivy:install] :: resolving dependencies ::
[ivy:install] found org.apache.ant#ant;1.7.1 in chained-resolvers
[ivy:install] found org.apache.ant#ant-launcher;1.7.1 in chained-resolvers
[ivy:install] found xerces#xercesImpl;2.9.0 in chained-resolvers
[ivy:install] found xml-apis#xml-apis;1.3.04 in chained-resolvers
[ivy:install] :: downloading artifacts to cache ::
[ivy:install] downloading
/home/toddg/src/Main/RSI/etc/holmes/main/asi-ivy-repo/repo/asi/xerces/xercesImpl/jars/xercesImpl-2.9.0.jar
...
[ivy:install] .................... (1195kB)
[ivy:install] .. (0kB)
[ivy:install] downloading
http://repo1.maven.org/maven2/xerces/xercesImpl/2.9.0/xercesImpl-2.9.0.jar
...
[ivy:install] ..............................................................
[ivy:install]
.................................................................................................................................................................................................................................................................................
[ivy:install]
....................................................................................................................................................................................................................................................................................................................................
[ivy:install]
...................................................................................................................................................................
(1195kB)
[ivy:install] .. (0kB)
[ivy:install] downloading
http://repo1.maven.org/maven2/xerces/xercesImpl/2.9.0/xercesImpl-2.9.0.jar
...
[ivy:install]
......................................................................................................................................................................................................................................................
[ivy:install]
........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
[ivy:install]
................................................................ (1195kB)
[ivy:install] .. (0kB)
[ivy:install] :: installing in local-repository ::
[ivy:install] published ant to
/home/toddg/src/Main/RSI/etc/holmes/main/asi-ivy-repo/repo/asi/org.apache.ant/ant/jars/ant-1.7.1.jar
[ivy:install] published ivy to
/home/toddg/src/Main/RSI/etc/holmes/main/asi-ivy-repo/repo/asi/org.apache.ant/ant/ivys/ivy-1.7.1.xml
[ivy:install] published ant-launcher to
/home/toddg/src/Main/RSI/etc/holmes/main/asi-ivy-repo/repo/asi/org.apache.ant/ant-launcher/jars/ant-launcher-1.7.1.jar
[ivy:install] published ivy to
/home/toddg/src/Main/RSI/etc/holmes/main/asi-ivy-repo/repo/asi/org.apache.ant/ant-launcher/ivys/ivy-1.7.1.xml
[ivy:install] published ivy to
/home/toddg/src/Main/RSI/etc/holmes/main/asi-ivy-repo/repo/asi/xerces/xercesImpl/ivys/ivy-2.9.0.xml
[ivy:install] published xml-apis to
/home/toddg/src/Main/RSI/etc/holmes/main/asi-ivy-repo/repo/asi/xml-apis/xml-apis/jars/xml-apis-1.3.04.jar
[ivy:install] published ivy to
/home/toddg/src/Main/RSI/etc/holmes/main/asi-ivy-repo/repo/asi/xml-apis/xml-apis/ivys/ivy-1.3.04.xml
[ivy:install] :: install resolution report ::
[ivy:install] :: resolution report :: resolve 0ms :: artifacts dl 10809ms
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| default | 4 | 0 | 0 | 0 || 4 | 0 |
---------------------------------------------------------------------
[ivy:install]
[ivy:install] :: problems summary ::
[ivy:install] :::: WARNINGS
[ivy:install] [FAILED ] xerces#xercesImpl;2.9.0!xercesImpl.jar:
invalid sha1: expected=sha1(xercesimpl-2.9.0.jar)=
computed=868c0792233fc78d8c9bac29ac79ade988301318 (83ms)
[ivy:install] [FAILED ] xerces#xercesImpl;2.9.0!xercesImpl.jar:
invalid sha1: expected=sha1(xercesimpl-2.9.0.jar)=
computed=868c0792233fc78d8c9bac29ac79ade988301318 (5735ms)
[ivy:install] [FAILED ] xerces#xercesImpl;2.9.0!xercesImpl.jar:
invalid sha1: expected=sha1(xercesimpl-2.9.0.jar)=
computed=868c0792233fc78d8c9bac29ac79ade988301318 (3959ms)
[ivy:install] [FAILED ] xerces#xercesImpl;2.9.0!xercesImpl.jar: (0ms)
[ivy:install] ==== local-repository: tried
[ivy:install]
/home/toddg/src/Main/RSI/etc/holmes/main/asi-ivy-repo/repo/asi/xerces/xercesImpl/jars/xercesImpl-2.9.0.jar
[ivy:install] ==== codehaus-snapshots: tried
[ivy:install]
http://snapshots.repository.codehaus.org/xerces/xercesImpl/2.9.0/xercesImpl-2.9.0.jar
[ivy:install] ==== codehaus: tried
[ivy:install]
http://repository.codehaus.org/xerces/xercesImpl/2.9.0/xercesImpl-2.9.0.jar
[ivy:install] ==== javanet: tried
[ivy:install]
http://download.java.net/maven/2/xerces/xercesImpl/2.9.0/xercesImpl-2.9.0.jar
[ivy:install] ==== libraries: tried
[ivy:install]
http://repo1.maven.org/maven2/xerces/xercesImpl/2.9.0/xercesImpl-2.9.0.jar
[ivy:install] ==== mirrors: tried
[ivy:install]
http://mirrors.ibiblio.org/pub/mirrors/maven2/xercesImpl/jars/xercesImpl-2.9.0.jar
[ivy:install] ==== public: tried
[ivy:install]
http://repo1.maven.org/maven2/xerces/xercesImpl/2.9.0/xercesImpl-2.9.0.jar
[ivy:install] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:install] :: FAILED DOWNLOADS ::
[ivy:install] :: ^ see resolution messages for details ^ ::
[ivy:install] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:install] :: xerces#xercesImpl;2.9.0!xercesImpl.jar
[ivy:install] ::::::::::::::::::::::::::::::::::::::::::::::
=============================================
Q2: How do I resolve this dependency problem?
=============================================
The resource is at this url:
http://repo1.maven.org/maven2/xerces/xercesImpl/2.9.0/xercesImpl-2.9.0.jar
However, the resource does not match the sha1 calculated for it.
=============================================
Q3: What does should a member of the maven/ivy community do, in the case
of mismatched sha1/md5 values?
=============================================
Where do we report such problems? Presumably, someone either this is an
administrative mistake, or the file has been compromised. In either
case, where does it get reported, and who takes care of this?
=============================================
Q4: Assuming that I can simply download the files I need for my local
repository directly from the web, what steps are necessary in order to
populate my local repository?
=============================================
For example, is there a publish task that will take a given resource
(jar) generate the sha1, and then copy it into my repository ? I have
tried simply copying the files to the directory I suspect they should go
to, but when I run ivy to resolve dependencies for my repo, they are
ignored.
=============================================
Q5: What should community members do when they come across other
mistakes in public repositories, such as seeing an 'O' (as in october)
where one would expect a '0' (as in zero)?
=============================================
For instance, the xpp3_min module makes this mistake:
<ivy:install organisation="xpp3" module="xpp3_min" revision="1.1.3.4.O"
=============================================
Q6: In other cases, ivy is not using the correct url for the resource.
Even though I can find the resource on the web, I don't know how to
change the url that ivy is using to retrieve that resource... how do I
do this?
=============================================
For instance, I'm attempting to download jett-util 6.1.4. The url for
this (as found from the mvnrepository.com website) is:
Resource located at:
http://mirrors.ibiblio.org/pub/mirrors/maven2/org/mortbay/jetty/jetty-util/6.1.4/jetty-util-6.1.4-sources.jar
However, the urls that ivy is using are all incorrect:
Attempted:
http://mirrors.ibiblio.org/pub/mirrors/maven2/jetty-util/jars/jetty-util-6.1.4.jar
Log snippet below:
=============================================
Q7: This seems like what the rules are supposed to handle, as described
in this doc page:
http://ant.apache.org/ivy/history/2.1.0-rc1/tutorial/build-repository/advanced.html
=============================================
However, I've read this page at least 10 times, and I still don't
understand all that it is saying:
1.<src org="apache" module=".+"/> // what is .+ ?, in other places
I've seen (.+)...are these different?
2. <dest org="$m0" module="$m0"/> // what is $m0, $m1, ...?
Could someone explain or give examples for what this section is saying?
"""
To understand namespaces,
* fromsystem : we define here that the projects defined in the
system namespace under the organization called "apache" are transformed
into the destination namespace into projects whose organization is named
with the module name, whatever the revision is. For example, the project
apache#commons-lang;1.0 in the system namespace will be translated into
commons-lang#commons-lang;1.0 in the maven2 resolver namespace.
* tosystem : we define here the reverse mapping, ie how to
translate apache projects from maven 2 repo into apache projects in the
system namespace. The rule used here tells that all projects matching
commons-.+ (see it as java regular expression) for their organization
name and module name are transformed into projects whose organisation is
apache with the module name as it was found. The same kind of rule is
applied for others apache projects like ant, etc.
"""
Log Snippet:
---------------------------------------------
[ivy:install] :: installing jetty#jetty-util;6.1.4 ::
[ivy:install] :: resolving dependencies ::
[ivy:install] :: downloading artifacts to cache ::
[ivy:install] :: installing in local-repository ::
[ivy:install] :: install resolution report ::
[ivy:install] :: resolution report :: resolve 0ms :: artifacts dl 0ms
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| default | 1 | 0 | 0 | 0 || 0 | 0 |
---------------------------------------------------------------------
[ivy:install]
[ivy:install] :: problems summary ::
[ivy:install] :::: WARNINGS
[ivy:install] module not found: jetty#jetty-util;6.1.4
[ivy:install] ==== local-repository: tried
[ivy:install]
/home/toddg/src/Main/RSI/etc/holmes/main/asi-ivy-repo/repo/asi/jetty/jetty-util/ivys/ivy-6.1.4.xml
[ivy:install] -- artifact jetty#jetty-util;6.1.4!jetty-util.jar:
[ivy:install]
/home/toddg/src/Main/RSI/etc/holmes/main/asi-ivy-repo/repo/asi/jetty/jetty-util/jars/jetty-util-6.1.4.jar
[ivy:install] ==== codehaus-snapshots: tried
[ivy:install]
http://snapshots.repository.codehaus.org/jetty/jetty-util/6.1.4/jetty-util-6.1.4.pom
[ivy:install] -- artifact jetty#jetty-util;6.1.4!jetty-util.jar:
[ivy:install]
http://snapshots.repository.codehaus.org/jetty/jetty-util/6.1.4/jetty-util-6.1.4.jar
[ivy:install] ==== codehaus: tried
[ivy:install]
http://repository.codehaus.org/jetty/jetty-util/6.1.4/jetty-util-6.1.4.pom
[ivy:install] -- artifact jetty#jetty-util;6.1.4!jetty-util.jar:
[ivy:install]
http://repository.codehaus.org/jetty/jetty-util/6.1.4/jetty-util-6.1.4.jar
[ivy:install] ==== javanet: tried
[ivy:install]
http://download.java.net/maven/2/jetty/jetty-util/6.1.4/jetty-util-6.1.4.pom
[ivy:install] -- artifact jetty#jetty-util;6.1.4!jetty-util.jar:
[ivy:install]
http://download.java.net/maven/2/jetty/jetty-util/6.1.4/jetty-util-6.1.4.jar
[ivy:install] ==== libraries: tried
[ivy:install]
http://repo1.maven.org/maven2/jetty/jetty-util/6.1.4/jetty-util-6.1.4.pom
[ivy:install] -- artifact jetty#jetty-util;6.1.4!jetty-util.jar:
[ivy:install]
http://repo1.maven.org/maven2/jetty/jetty-util/6.1.4/jetty-util-6.1.4.jar
[ivy:install] ==== mirrors: tried
[ivy:install] -- artifact jetty#jetty-util;6.1.4!jetty-util.jar:
[ivy:install]
http://mirrors.ibiblio.org/pub/mirrors/maven2/jetty-util/jars/jetty-util-6.1.4.jar
[ivy:install] ==== public: tried
[ivy:install]
http://repo1.maven.org/maven2/jetty/jetty-util/6.1.4/jetty-util-6.1.4.pom
[ivy:install] -- artifact jetty#jetty-util;6.1.4!jetty-util.jar:
[ivy:install]
http://repo1.maven.org/maven2/jetty/jetty-util/6.1.4/jetty-util-6.1.4.jar
[ivy:install] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:install] :: UNRESOLVED DEPENDENCIES ::
[ivy:install] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:install] :: jetty#jetty-util;6.1.4: not found
[ivy:install] ::::::::::::::::::::::::::::::::::::::::::::::
---------------------------------------------------
Thanks for your time.
-Todd
Re: Managing an ivy repository and resolving dependencies
Posted by Antoine Levy-Lambert <an...@gmx.de>.
Todd Greenwood-Geer wrote:
>
>
> =============================================
> Q2: How do I resolve this dependency problem?
> =============================================
>
> The resource is at this url:
> http://repo1.maven.org/maven2/xerces/xercesImpl/2.9.0/xercesImpl-2.9.0.jar
>
>
> However, the resource does not match the sha1 calculated for it.
>
> =============================================
> Q3: What does should a member of the maven/ivy community do, in the
> case of mismatched sha1/md5 values?
> =============================================
>
> Where do we report such problems? Presumably, someone either this is
> an administrative mistake, or the file has been compromised. In either
> case, where does it get reported, and who takes care of this?
>
Hello Todd,
requests concerning the public maven repository are entered at this
location :
http://jira.codehaus.org/browse/MAVENUPLOAD
There is also a discussion list repository@apache.org
and this web page http://maven.apache.org/repository/index.html should
be one of the references.
> =============================================
> Q4: Assuming that I can simply download the files I need for my local
> repository directly from the web, what steps are necessary in order to
> populate my local repository?
> =============================================
>
> For example, is there a publish task that will take a given resource
> (jar) generate the sha1, and then copy it into my repository ? I have
> tried simply copying the files to the directory I suspect they should
> go to, but when I run ivy to resolve dependencies for my repo, they
> are ignored.
Yes, there is an ivy publish task. My project is using ivy a lot, and we
are creating our own ivy descriptors for all third party jars that we
use. In fact, usage scenarios vary from project to project, the precise
list of jars that you want to use when using a particular third party
can change across time ... there are lots of reasons to maintain one's
own project repository. It takes time to create one's ivy xml files, but
when it is well done it saves time.
Regards,
Antoine
Re: Managing an ivy repository and resolving dependencies : Bug?
Posted by Todd Greenwood-Geer <t....@gmail.com>.
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
Re: Managing an ivy repository and resolving dependencies
Posted by Todd Greenwood-Geer <t....@gmail.com>.
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
RE: Managing an ivy repository and resolving dependencies
Posted by Tetyana Sotnykova <Te...@epam.com>.
>=============================================
>Q5: What should community members do when they come across other
>mistakes in public repositories, such as seeing an 'O' (as in october)
>where one would expect a '0' (as in zero)?
>=============================================
>
>For instance, the xpp3_min module makes this mistake:
>
><ivy:install organisation="xpp3" module="xpp3_min" revision="1.1.3.4.O"
It is right version - 1.1.3.4.O - there are also 1.1.3.4.D, 1.1.3.4.G and so on (http://www.extreme.indiana.edu/dist/java-repository/xpp3/jars/)
-----Original Message-----
From: Todd Greenwood-Geer [mailto:t.greenwoodgeer@gmail.com]
Sent: Friday, April 17, 2009 3:01 AM
To: ivy-user@ant.apache.org
Subject: Managing an ivy repository and resolving dependencies
Hi,
I'm very interested in apache ivy and the benefits it provides. However,
I'm having some problems...I apologize in advance for the lengthy email.
Questions are labeled "Q[0-9]:" below:
I've created an ivy repository, but I'm having difficulties as some of
the dependencies are not resolving. For example, here it looks as though
I'm attempting to install ant 1.7.1, however, it is failing because
xercesImpl 2.9.0 is not resolving.
=============================================
Q1: is that a correct assessment of this log?
(more questions below...)
=============================================
[ivy:install] :: installing org.apache.ant#ant;1.7.1 ::
[ivy:install] :: resolving dependencies ::
[ivy:install] found org.apache.ant#ant;1.7.1 in chained-resolvers
[ivy:install] found org.apache.ant#ant-launcher;1.7.1 in chained-resolvers
[ivy:install] found xerces#xercesImpl;2.9.0 in chained-resolvers
[ivy:install] found xml-apis#xml-apis;1.3.04 in chained-resolvers
[ivy:install] :: downloading artifacts to cache ::
[ivy:install] downloading
/home/toddg/src/Main/RSI/etc/holmes/main/asi-ivy-repo/repo/asi/xerces/xercesImpl/jars/xercesImpl-2.9.0.jar
...
[ivy:install] .................... (1195kB)
[ivy:install] .. (0kB)
[ivy:install] downloading
http://repo1.maven.org/maven2/xerces/xercesImpl/2.9.0/xercesImpl-2.9.0.jar
...
[ivy:install] ..............................................................
[ivy:install]
.................................................................................................................................................................................................................................................................................
[ivy:install]
....................................................................................................................................................................................................................................................................................................................................
[ivy:install]
...................................................................................................................................................................
(1195kB)
[ivy:install] .. (0kB)
[ivy:install] downloading
http://repo1.maven.org/maven2/xerces/xercesImpl/2.9.0/xercesImpl-2.9.0.jar
...
[ivy:install]
......................................................................................................................................................................................................................................................
[ivy:install]
........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
[ivy:install]
................................................................ (1195kB)
[ivy:install] .. (0kB)
[ivy:install] :: installing in local-repository ::
[ivy:install] published ant to
/home/toddg/src/Main/RSI/etc/holmes/main/asi-ivy-repo/repo/asi/org.apache.ant/ant/jars/ant-1.7.1.jar
[ivy:install] published ivy to
/home/toddg/src/Main/RSI/etc/holmes/main/asi-ivy-repo/repo/asi/org.apache.ant/ant/ivys/ivy-1.7.1.xml
[ivy:install] published ant-launcher to
/home/toddg/src/Main/RSI/etc/holmes/main/asi-ivy-repo/repo/asi/org.apache.ant/ant-launcher/jars/ant-launcher-1.7.1.jar
[ivy:install] published ivy to
/home/toddg/src/Main/RSI/etc/holmes/main/asi-ivy-repo/repo/asi/org.apache.ant/ant-launcher/ivys/ivy-1.7.1.xml
[ivy:install] published ivy to
/home/toddg/src/Main/RSI/etc/holmes/main/asi-ivy-repo/repo/asi/xerces/xercesImpl/ivys/ivy-2.9.0.xml
[ivy:install] published xml-apis to
/home/toddg/src/Main/RSI/etc/holmes/main/asi-ivy-repo/repo/asi/xml-apis/xml-apis/jars/xml-apis-1.3.04.jar
[ivy:install] published ivy to
/home/toddg/src/Main/RSI/etc/holmes/main/asi-ivy-repo/repo/asi/xml-apis/xml-apis/ivys/ivy-1.3.04.xml
[ivy:install] :: install resolution report ::
[ivy:install] :: resolution report :: resolve 0ms :: artifacts dl 10809ms
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| default | 4 | 0 | 0 | 0 || 4 | 0 |
---------------------------------------------------------------------
[ivy:install]
[ivy:install] :: problems summary ::
[ivy:install] :::: WARNINGS
[ivy:install] [FAILED ] xerces#xercesImpl;2.9.0!xercesImpl.jar:
invalid sha1: expected=sha1(xercesimpl-2.9.0.jar)=
computed=868c0792233fc78d8c9bac29ac79ade988301318 (83ms)
[ivy:install] [FAILED ] xerces#xercesImpl;2.9.0!xercesImpl.jar:
invalid sha1: expected=sha1(xercesimpl-2.9.0.jar)=
computed=868c0792233fc78d8c9bac29ac79ade988301318 (5735ms)
[ivy:install] [FAILED ] xerces#xercesImpl;2.9.0!xercesImpl.jar:
invalid sha1: expected=sha1(xercesimpl-2.9.0.jar)=
computed=868c0792233fc78d8c9bac29ac79ade988301318 (3959ms)
[ivy:install] [FAILED ] xerces#xercesImpl;2.9.0!xercesImpl.jar: (0ms)
[ivy:install] ==== local-repository: tried
[ivy:install]
/home/toddg/src/Main/RSI/etc/holmes/main/asi-ivy-repo/repo/asi/xerces/xercesImpl/jars/xercesImpl-2.9.0.jar
[ivy:install] ==== codehaus-snapshots: tried
[ivy:install]
http://snapshots.repository.codehaus.org/xerces/xercesImpl/2.9.0/xercesImpl-2.9.0.jar
[ivy:install] ==== codehaus: tried
[ivy:install]
http://repository.codehaus.org/xerces/xercesImpl/2.9.0/xercesImpl-2.9.0.jar
[ivy:install] ==== javanet: tried
[ivy:install]
http://download.java.net/maven/2/xerces/xercesImpl/2.9.0/xercesImpl-2.9.0.jar
[ivy:install] ==== libraries: tried
[ivy:install]
http://repo1.maven.org/maven2/xerces/xercesImpl/2.9.0/xercesImpl-2.9.0.jar
[ivy:install] ==== mirrors: tried
[ivy:install]
http://mirrors.ibiblio.org/pub/mirrors/maven2/xercesImpl/jars/xercesImpl-2.9.0.jar
[ivy:install] ==== public: tried
[ivy:install]
http://repo1.maven.org/maven2/xerces/xercesImpl/2.9.0/xercesImpl-2.9.0.jar
[ivy:install] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:install] :: FAILED DOWNLOADS ::
[ivy:install] :: ^ see resolution messages for details ^ ::
[ivy:install] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:install] :: xerces#xercesImpl;2.9.0!xercesImpl.jar
[ivy:install] ::::::::::::::::::::::::::::::::::::::::::::::
=============================================
Q2: How do I resolve this dependency problem?
=============================================
The resource is at this url:
http://repo1.maven.org/maven2/xerces/xercesImpl/2.9.0/xercesImpl-2.9.0.jar
However, the resource does not match the sha1 calculated for it.
=============================================
Q3: What does should a member of the maven/ivy community do, in the case
of mismatched sha1/md5 values?
=============================================
Where do we report such problems? Presumably, someone either this is an
administrative mistake, or the file has been compromised. In either
case, where does it get reported, and who takes care of this?
=============================================
Q4: Assuming that I can simply download the files I need for my local
repository directly from the web, what steps are necessary in order to
populate my local repository?
=============================================
For example, is there a publish task that will take a given resource
(jar) generate the sha1, and then copy it into my repository ? I have
tried simply copying the files to the directory I suspect they should go
to, but when I run ivy to resolve dependencies for my repo, they are
ignored.
=============================================
Q5: What should community members do when they come across other
mistakes in public repositories, such as seeing an 'O' (as in october)
where one would expect a '0' (as in zero)?
=============================================
For instance, the xpp3_min module makes this mistake:
<ivy:install organisation="xpp3" module="xpp3_min" revision="1.1.3.4.O"
=============================================
Q6: In other cases, ivy is not using the correct url for the resource.
Even though I can find the resource on the web, I don't know how to
change the url that ivy is using to retrieve that resource... how do I
do this?
=============================================
For instance, I'm attempting to download jett-util 6.1.4. The url for
this (as found from the mvnrepository.com website) is:
Resource located at:
http://mirrors.ibiblio.org/pub/mirrors/maven2/org/mortbay/jetty/jetty-util/6.1.4/jetty-util-6.1.4-sources.jar
However, the urls that ivy is using are all incorrect:
Attempted:
http://mirrors.ibiblio.org/pub/mirrors/maven2/jetty-util/jars/jetty-util-6.1.4.jar
Log snippet below:
=============================================
Q7: This seems like what the rules are supposed to handle, as described
in this doc page:
http://ant.apache.org/ivy/history/2.1.0-rc1/tutorial/build-repository/advanced.html
=============================================
However, I've read this page at least 10 times, and I still don't
understand all that it is saying:
1.<src org="apache" module=".+"/> // what is .+ ?, in other places
I've seen (.+)...are these different?
2. <dest org="$m0" module="$m0"/> // what is $m0, $m1, ...?
Could someone explain or give examples for what this section is saying?
"""
To understand namespaces,
* fromsystem : we define here that the projects defined in the
system namespace under the organization called "apache" are transformed
into the destination namespace into projects whose organization is named
with the module name, whatever the revision is. For example, the project
apache#commons-lang;1.0 in the system namespace will be translated into
commons-lang#commons-lang;1.0 in the maven2 resolver namespace.
* tosystem : we define here the reverse mapping, ie how to
translate apache projects from maven 2 repo into apache projects in the
system namespace. The rule used here tells that all projects matching
commons-.+ (see it as java regular expression) for their organization
name and module name are transformed into projects whose organisation is
apache with the module name as it was found. The same kind of rule is
applied for others apache projects like ant, etc.
"""
Log Snippet:
---------------------------------------------
[ivy:install] :: installing jetty#jetty-util;6.1.4 ::
[ivy:install] :: resolving dependencies ::
[ivy:install] :: downloading artifacts to cache ::
[ivy:install] :: installing in local-repository ::
[ivy:install] :: install resolution report ::
[ivy:install] :: resolution report :: resolve 0ms :: artifacts dl 0ms
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| default | 1 | 0 | 0 | 0 || 0 | 0 |
---------------------------------------------------------------------
[ivy:install]
[ivy:install] :: problems summary ::
[ivy:install] :::: WARNINGS
[ivy:install] module not found: jetty#jetty-util;6.1.4
[ivy:install] ==== local-repository: tried
[ivy:install]
/home/toddg/src/Main/RSI/etc/holmes/main/asi-ivy-repo/repo/asi/jetty/jetty-util/ivys/ivy-6.1.4.xml
[ivy:install] -- artifact jetty#jetty-util;6.1.4!jetty-util.jar:
[ivy:install]
/home/toddg/src/Main/RSI/etc/holmes/main/asi-ivy-repo/repo/asi/jetty/jetty-util/jars/jetty-util-6.1.4.jar
[ivy:install] ==== codehaus-snapshots: tried
[ivy:install]
http://snapshots.repository.codehaus.org/jetty/jetty-util/6.1.4/jetty-util-6.1.4.pom
[ivy:install] -- artifact jetty#jetty-util;6.1.4!jetty-util.jar:
[ivy:install]
http://snapshots.repository.codehaus.org/jetty/jetty-util/6.1.4/jetty-util-6.1.4.jar
[ivy:install] ==== codehaus: tried
[ivy:install]
http://repository.codehaus.org/jetty/jetty-util/6.1.4/jetty-util-6.1.4.pom
[ivy:install] -- artifact jetty#jetty-util;6.1.4!jetty-util.jar:
[ivy:install]
http://repository.codehaus.org/jetty/jetty-util/6.1.4/jetty-util-6.1.4.jar
[ivy:install] ==== javanet: tried
[ivy:install]
http://download.java.net/maven/2/jetty/jetty-util/6.1.4/jetty-util-6.1.4.pom
[ivy:install] -- artifact jetty#jetty-util;6.1.4!jetty-util.jar:
[ivy:install]
http://download.java.net/maven/2/jetty/jetty-util/6.1.4/jetty-util-6.1.4.jar
[ivy:install] ==== libraries: tried
[ivy:install]
http://repo1.maven.org/maven2/jetty/jetty-util/6.1.4/jetty-util-6.1.4.pom
[ivy:install] -- artifact jetty#jetty-util;6.1.4!jetty-util.jar:
[ivy:install]
http://repo1.maven.org/maven2/jetty/jetty-util/6.1.4/jetty-util-6.1.4.jar
[ivy:install] ==== mirrors: tried
[ivy:install] -- artifact jetty#jetty-util;6.1.4!jetty-util.jar:
[ivy:install]
http://mirrors.ibiblio.org/pub/mirrors/maven2/jetty-util/jars/jetty-util-6.1.4.jar
[ivy:install] ==== public: tried
[ivy:install]
http://repo1.maven.org/maven2/jetty/jetty-util/6.1.4/jetty-util-6.1.4.pom
[ivy:install] -- artifact jetty#jetty-util;6.1.4!jetty-util.jar:
[ivy:install]
http://repo1.maven.org/maven2/jetty/jetty-util/6.1.4/jetty-util-6.1.4.jar
[ivy:install] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:install] :: UNRESOLVED DEPENDENCIES ::
[ivy:install] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:install] :: jetty#jetty-util;6.1.4: not found
[ivy:install] ::::::::::::::::::::::::::::::::::::::::::::::
---------------------------------------------------
Thanks for your time.
-Todd