Hi Zac,

That does help the specific use case that I noted. Thank you for this idea. I'll go ahead with this approach.

-Jaikiran


On Wednesday 27 May 2015 11:36 PM, Zac Jacobson wrote:
If you rearrange your extends attributes on your conf elements, You can achieve 
what I think you’re asking.

runtime
compile extends runtime
provided extends runtime
test extends provided

You would indicate that the org.myapp dependencies are in the runtime 
configuration.

Here, when you retrieve compile or test, it would include all the libraries you 
need for those activities. But runtime would include only the libraries you 
need for deployment, and would exclude the additional libraries indicated by 
compile, provided, and test configurations.



On May 27, 2015, at 08:18, Jaikiran Pai <jai.forums2...@gmail.com> wrote:

I'm using 2.4.0 of Ivy. I'm trying to ivy:retrieve a bunch of dependencies 
which _do not_ belong to a specific configuration. Here's what the ivy.xml 
looks like:

<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0">
    <info organisation="myfoo.org" module="hello" revision="0.0.1-SNAPSHOT"/>

    <configurations defaultconfmapping="compile->default;runtime->runtime">
        <conf name="compile" description="Required at compile time"/>
        <conf name="runtime" description="Required at runtime" 
extends="compile"/>
        <conf name="provided" description="Provided by the container environment" 
visibility="private"/>
        <conf name="default" description="An alias for runtime configuration" 
extends="runtime"/>
        <conf name="test" description="Required for tests only" extends="runtime" 
visibility="private"/>
    </configurations>

    <publications>
        <artifact name="hello" type="jar" ext="zip"/>
    </publications>


    <dependencies>
        <dependency org="org.thirdparty" name="container" rev="1.0.0" 
conf="compile->default;provided->default;runtime->runtime;"/>

        <dependency org="org.myapp" name="foo" rev="1.0.0"/>
        <dependency org="org.myapp" name="bar" rev="1.0.0" />

        <dependency org="org.testng" name="testng" rev="6.1.1" 
conf="test->default"/>

    </dependencies>
</ivy-module>


What I intend to do is retrieve only the org.myapp:foo and org.myapp:bar dependencies (i.e. those 
that don't belong to "provided" or "test" conf) into a specific folder during 
the build. build.xml looks like:

<ivy:retrieve pattern="${dist.dir}/${dist.name}/lib/[artifact](-[classifier]).[ext]" 
conf="!provided,!test" type="jar,bundle" overwritemode="always"/>

This ends up failing with errors like:

build.xml:123: impossible to ivy retrieve: java.lang.RuntimeException: problem 
during retrieve of org.myapp#hello: java.lang.IllegalStateException: Report 
file '/.ivy2/cache/org.myapp-hello-!provided.xml' does not exist.
    at 
org.apache.ivy.core.retrieve.RetrieveEngine.retrieve(RetrieveEngine.java:249)
    at org.apache.ivy.Ivy.retrieve(Ivy.java:561)
    at org.apache.ivy.ant.IvyRetrieve.doExecute(IvyRetrieve.java:98)
    at org.apache.ivy.ant.IvyTask.execute(IvyTask.java:271)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at 
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:435)
    at org.apache.tools.ant.Target.performTasks(Target.java:456)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
    at 
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
    at org.apache.tools.ant.Main.runBuild(Main.java:851)
    at org.apache.tools.ant.Main.startAnt(Main.java:235)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
java.lang.IllegalStateException: Report file 
'/.ivy2/cache/org.myapp-hello-!provided.xml' does not exist.
    at 
org.apache.ivy.plugins.report.XmlReportParser.parse(XmlReportParser.java:285)
    at 
org.apache.ivy.core.retrieve.RetrieveEngine.determineArtifactsToCopy(RetrieveEngine.java:329)
    at 
org.apache.ivy.core.retrieve.RetrieveEngine.retrieve(RetrieveEngine.java:118)
    ... 19 more


Is there some way, I can retrieve dependencies that do not belong to specific 
conf(s)?

-Jaikiran

Reply via email to