Ivy
  1. Ivy
  2. IVY-982

Dependency Configuration Negation does not work

    Details

    • Type: Bug Bug
    • Status: Reopened
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0-RC2, 2.0
    • Fix Version/s: None
    • Component/s: Core
    • Labels:
      None
    • Environment:

      windows xp
      java 1.5 build 1.5.0_14-b03
      ant 1.7.0

      Description

      I am trying the define a dependency for all configurations in my module, except for the configuration named hibernate. So I defined the following dependency in my ivy.xml file:

      <dependency org="spring" name="spring-framework" rev="2.5.1" conf="*, !hibernate -> web"/>

      However, when resolving, I get the following error:

      [ivy:resolve] :: ivy-dependency-stubs#toolset#C2.0;MRC2.0: java.text.ParseException: Problem occured while parsing ivy file: Configuration '!hibernate' does not exist in module module: ivy-dependency-stubs#toolset#C2.0;MRC2.0 status=release publication=Fri Dec 05 10:50:34 CET 2008 configurations={compile=compile, test=test, ear=ear, hibernate=hibernate} artifacts={compile=[ivy-dependency-stubs#toolset#C2.0;MRC2.0!toolset.txt], hibernate=[ivy-dependency-stubs#toolset#C2.0;MRC2.0!toolset.txt], ear=[ivy-dependency-stubs#toolset#C2.0;MRC2.0!toolset.txt], test=[ivy-dependency-stubs#toolset#C2.0;MRC2.0!toolset.txt]} dependencies=[dependency: hibernate#hibernate#C2.0;3.2.6 {=[default]}, dependency: spring#spring-framework#C2.0;2.5.1 {=[web]}] in file:/R:/ext950_r_costa_INCEPTION_int_dn/devtools/oobs/var/cache/ivy-dependency-stubs/toolset/C2.0/ivy-MRC2.0.xml.original

      A similar problem has already been reported to the ivy-user group by somebody else using the IvyDE, so I suspect it's a Ivy-core problem?
      See: http://www.nabble.com/Dependency-Configuration-Negation-ts20129596.html#a20129596

      Attached is the stack trace:

      BUILD FAILED
      R:\ext950_r_costa_INCEPTION_int_dn\devtools\oobs\oobs-base.xml:124: The following error occurred while executing this line
      :
      R:\ext950_r_costa_INCEPTION_int_dn\devtools\oobs\oobs-base.xml:125: impossible to resolve dependencies:
      resolve failed - see output for details
      at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:541)
      at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:394)
      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
      at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
      at org.apache.tools.ant.Task.perform(Task.java:348)
      at org.apache.tools.ant.Target.execute(Target.java:357)
      at org.apache.tools.ant.Target.performTasks(Target.java:385)
      at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
      at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
      at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
      at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
      at org.apache.tools.ant.Main.runBuild(Main.java:698)
      at org.apache.tools.ant.Main.startAnt(Main.java:199)
      at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
      at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
      Caused by: R:\ext950_r_costa_INCEPTION_int_dn\devtools\oobs\oobs-base.xml:125: impossible to resolve dependencies:
      resolve failed - see output for details
      at org.apache.ivy.ant.IvyResolve.doExecute(IvyResolve.java:315)
      at org.apache.ivy.ant.IvyTask.execute(IvyTask.java:277)
      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
      at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
      at org.apache.tools.ant.Task.perform(Task.java:348)
      at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62)
      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
      at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
      at org.apache.tools.ant.Task.perform(Task.java:348)
      at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:391)
      ... 16 more
      Caused by: resolve failed - see output for details
      at org.apache.ivy.ant.IvyResolve.doExecute(IvyResolve.java:241)
      ... 31 more
      — Nested Exception —
      R:\ext950_r_costa_INCEPTION_int_dn\devtools\oobs\oobs-base.xml:125: impossible to resolve dependencies:
      resolve failed - see output for details
      at org.apache.ivy.ant.IvyResolve.doExecute(IvyResolve.java:315)
      at org.apache.ivy.ant.IvyTask.execute(IvyTask.java:277)
      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
      at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
      at org.apache.tools.ant.Task.perform(Task.java:348)
      at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62)
      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
      at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
      at org.apache.tools.ant.Task.perform(Task.java:348)
      at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:391)
      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
      at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
      at org.apache.tools.ant.Task.perform(Task.java:348)
      at org.apache.tools.ant.Target.execute(Target.java:357)
      at org.apache.tools.ant.Target.performTasks(Target.java:385)
      at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
      at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
      at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
      at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
      at org.apache.tools.ant.Main.runBuild(Main.java:698)
      at org.apache.tools.ant.Main.startAnt(Main.java:199)
      at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
      at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
      Caused by: resolve failed - see output for details
      at org.apache.ivy.ant.IvyResolve.doExecute(IvyResolve.java:241)
      ... 31 more
      — Nested Exception —
      resolve failed - see output for details
      at org.apache.ivy.ant.IvyResolve.doExecute(IvyResolve.java:241)
      at org.apache.ivy.ant.IvyTask.execute(IvyTask.java:277)
      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
      at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
      at org.apache.tools.ant.Task.perform(Task.java:348)
      at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62)
      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
      at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
      at org.apache.tools.ant.Task.perform(Task.java:348)
      at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:391)
      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
      at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
      at org.apache.tools.ant.Task.perform(Task.java:348)
      at org.apache.tools.ant.Target.execute(Target.java:357)
      at org.apache.tools.ant.Target.performTasks(Target.java:385)
      at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
      at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
      at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
      at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
      at org.apache.tools.ant.Main.runBuild(Main.java:698)
      at org.apache.tools.ant.Main.startAnt(Main.java:199)
      at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
      at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

        Activity

        Hide
        Vadim Kopichenko added a comment - - edited

        It would be very nice if negation also worked with exclude tags:
        <exclude org="log4j" conf="*,!provided"/>

        And it would be even nicer if negation worked as subtraction in configuration extension:
        <conf name="ear" extends="runtime,!system,!provided"/>

        See http://stackoverflow.com/questions/19227004/how-to-subtract-ivy-dependency-sets for this feature request description. Looks like a common problem.

        Show
        Vadim Kopichenko added a comment - - edited It would be very nice if negation also worked with exclude tags: <exclude org="log4j" conf="*,!provided"/> And it would be even nicer if negation worked as subtraction in configuration extension: <conf name="ear" extends="runtime,!system,!provided"/> See http://stackoverflow.com/questions/19227004/how-to-subtract-ivy-dependency-sets for this feature request description. Looks like a common problem.
        Hide
        Ahti Urb added a comment -

        up! Negation does still not work in 2.2 nor 2.3 rc1 - it just silently does not respect the negated patterns in the configuration mapping and resolves the defined dependency anyway.
        Would be really useful to get it working.

        Show
        Ahti Urb added a comment - up! Negation does still not work in 2.2 nor 2.3 rc1 - it just silently does not respect the negated patterns in the configuration mapping and resolves the defined dependency anyway. Would be really useful to get it working.
        Hide
        Marc De Boeck added a comment -

        Retested with revision 745851:

        There is no crash anymore when using the !-character in the conf-attribute.
        However, the negation-functionality still does not seem to work in my case.

        Below is a snippet of my ivy.xml file containing the configurations and dependencies:

            <configurations >
        	    <conf name="compile"/>
        	    <conf name="test" extends="compile"/>
        	    <conf name="ear"/>
        	    <conf name="rad"/>
            </configurations>
            <dependencies >
                <dependency org="ivy-dependency-stubs" name="jaxws-protocol" rev="latest.integration" conf="*,!ear -> compile" />
            </dependencies>
        

        I then run an ant-build as follows:
        ant -Divy.default.configurations="ear" (where myconf is used in the ant-build file when calling the ivy:resolve task.

        And the result is the same for ivy.default.configurations="ear" as for ivy.default.configurations="compile".
        I would have expected that in the case of conf="ear", no dependency would be resolved.

        I will attache the output of ant -v (allthough I didn't see much relevant information in it).

        Show
        Marc De Boeck added a comment - Retested with revision 745851: There is no crash anymore when using the !-character in the conf-attribute. However, the negation-functionality still does not seem to work in my case. Below is a snippet of my ivy.xml file containing the configurations and dependencies: <configurations > <conf name= "compile" /> <conf name= "test" extends= "compile" /> <conf name= "ear" /> <conf name= "rad" /> </configurations> <dependencies > <dependency org= "ivy-dependency-stubs" name= "jaxws-protocol" rev= "latest.integration" conf= "*,!ear -> compile" /> </dependencies> I then run an ant-build as follows: ant -Divy.default.configurations="ear" (where myconf is used in the ant-build file when calling the ivy:resolve task. And the result is the same for ivy.default.configurations="ear" as for ivy.default.configurations="compile". I would have expected that in the case of conf="ear", no dependency would be resolved. I will attache the output of ant -v (allthough I didn't see much relevant information in it).
        Hide
        Maarten Coene added a comment -

        Fixed in SVN trunk.
        Could you give it a try?
        Maarten

        Show
        Maarten Coene added a comment - Fixed in SVN trunk. Could you give it a try? Maarten

          People

          • Assignee:
            Maarten Coene
            Reporter:
            Marc De Boeck
          • Votes:
            6 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated:

              Development