ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xavier Hanin" <>
Subject Re: How can I retrieve binary files and source files in one shot?
Date Thu, 03 Jan 2008 20:31:28 GMT
On Jan 1, 2008 5:23 PM, Alan She <> wrote:

> Hi,
> Is there any way to retrieve binary and sources
> by ibiblio resolver in one shot and put the
> binary jar file in lib/ and put the sources jar file in libsrc/  ?

The problem is that the metadata in the maven repository does not provide
any information on the presence or not of sources or javadocs, which is not
how Ivy is designed. In IvyDE we work around this problem by resolving an
artifact (the source artifact) not declared in metadata, so you can do it
also by calling Ivy from java.
There's also a way to declare a dependency artifact from the caller which
could be used here, but this is not as straightforward as with maven tasks.
You'd need something like that in your ivy file:
<dependency org="foo" name="bar" rev="1.0" conf="binary,source->default">
  <include name="*" conf="binary"/>
  <artifact name="bar" ext="jar" type="source" classifier="source"
conf="source" />

Then you'll get the binary artifact in the binary conf and the source
artifact in the source configuration of your module.



> I used maven ant task (an ant task for ant user to load libraries from
> maven2 repo) before,
> it can do this by something like the following:
>    <target name="retrieve-dependencies" description="Load libraries from
> maven2 repository.">
>        <artifact:dependencies filesetId="dependency.fileset"
>                               sourcesFilesetId="sources.dependency.fileset
> "
>                               versionsId="dependency.versions">
>            <pom file="pom.xml"/>
>        </artifact:dependencies>
>        <delete dir="${path.lib}"/>
>        <copy todir="${path.lib}">
>            <fileset refid="dependency.fileset"/>
>            <mapper classpathref="maven-ant-tasks.classpath" classname="
> org.apache.maven.artifact.ant.VersionMapper"
>                    from="${dependency.versions}" to="flatten"/>
>        </copy>
>        <delete dir="${path.libsrc}"/>
>        <copy todir="${path.libsrc}">
>            <fileset refid="sources.dependency.fileset"/>
>            <mapper classpathref="maven-ant-tasks.classpath" classname="
> org.apache.maven.artifact.ant.VersionMapper"
>                    from="${dependency.versions}" to="flatten"/>
>        </copy>
>    </target>
> I noticed that the pattern of ibiblio resolver has a (-[classifier]) which
> seems to be useful to this problem.
> But I have no idea how to get this work.
> Would you mind to give me some hints?
> Thanks a lot!
> Alan She

Xavier Hanin - Independent Java Consultant

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message