Hello,
Using the following worked:
<exec program="java" commandline="-jar ${ivy.jar} -retrieve
${lib.dir}/[artifact]-[type].[ext]"/>
Thank you Tom.
I doubt the Ant ivy:retrieve task fails silently because the artifacts are
successfully stored in the lib folder.
I just think that the default retrieve pattern for the ivy:retrieve ant task is
[artifact]-[type].[ext] but it is not the case for the retrieve from CLI hence
the need to explicitly specify it.
I've created a JIRA issue, the JIRA key is IVY-1064.
Thanks and regards,
- Georges
-----Original Message-----
From: Maarten Coene [mailto:[email protected]]
Sent: Thursday, April 16, 2009 7:01 AM
To: [email protected]
Subject: Re: Exception When Directly Executing The Ivy JAR.
I think the default behaviour of ivy:retrieve in Ant should be the same as the
retrieve from CLI, could you please create a JIRA issue for this?
Maarten
----- Original Message ----
From: Tom Widmer <[email protected]>
To: [email protected]
Sent: Thursday, April 16, 2009 1:42:57 AM
Subject: Re: Exception When Directly Executing The Ivy JAR.
Georges Labrèche wrote:
> Hello,
> I'm having issues when running ivy retrieve upon directly executing the JAR
> instead of using the ivy:retrieve task in Ant.
> The reason I am doing this is because I am using NAnt and the exec task
> instead of Ant and Ivy tasks.
> For instance, the build.xml Ant script of the hello-ivy example implements
> the following "resolve" target:
> <target name="resolve" description="--> retrieve dependencies with ivy">
> <ivy:retrieve/>
> </target>
> This works perfectly.
Or possibly fails silently...
> Porting this to a NAnt script would result in the following "resolve" target:
> <property name="ivy.jar" value="tools\ivy\ivy.jar"/>
> <target name="resolve" description="--> retrieve dependencies with ivy">
> <exec program="java" commandline="-jar ${ivy.jar} -retrieve ivy.xml"/>
> </target> Executing this task throws the following exception:
> -----------------------------------------------------------------------
> [exec] Exception in thread "main" java.lang.RuntimeException: problem
> durin
> g retrieve of Stream57#Cortex: java.lang.RuntimeException: Multiple artifacts
> of
> the module commons-cli#commons-cli;1.0 are retrieved to the same file!
> Update t
> he retrieve pattern to fix this error.
> [exec] :: retrieving :: Stream57#Cortex
> [exec] confs: [default]
> [exec] at
> org.apache.ivy.core.retrieve.RetrieveEngine.retrieve(RetrieveEng
> ine.java:196)
> [exec] at org.apache.ivy.Ivy.retrieve(Ivy.java:540)
> [exec] at org.apache.ivy.Main.run(Main.java:268)
> [exec] at org.apache.ivy.Main.main(Main.java:168)
> [exec] Caused by: java.lang.RuntimeException: Multiple artifacts of the
> mod
> ule commons-cli#commons-cli;1.0 are retrieved to the same file! Update the
> retri
> eve pattern to fix this error.
> [exec] at
> org.apache.ivy.core.retrieve.RetrieveEngine.determineArtifactsTo
> Copy(RetrieveEngine.java:349)
> [exec] at
> org.apache.ivy.core.retrieve.RetrieveEngine.retrieve(RetrieveEng
> ine.java:102)
> [exec] ... 3 more
>
> The error message suggests to "update the retrieve pattern to fix this
> error." So I have also tried the following:
> <exec program="java" commandline="-jar ${ivy.jar} -retrieve
> ${lib.dir}/[artifact].[ext]"/>
> But the same exception is thrown.
> Any ideas?
I think it's a real error, since commons-cli (in common with many maven
generated libraries) probably has multiple artifacts with the same name (lib,
sources and javadoc). Try something like
<exec program="java" commandline="-jar ${ivy.jar} -retrieve
${lib.dir}/[artifact]-[type].[ext]"/>
or, better, update your ivy.xml file so you only depend on the default conf of
maven artifacts, and not *.
Tom