You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-commits@incubator.apache.org by "Oystein Aadland (JIRA)" <ji...@apache.org> on 2007/06/26 10:01:26 UTC

[jira] Created: (IVY-541) Transitive dependencies resolves incorrectly when different modules uses the same dependency with different configurations in the same build

Transitive dependencies resolves incorrectly when different modules uses the same dependency with different configurations in the same build
--------------------------------------------------------------------------------------------------------------------------------------------

                 Key: IVY-541
                 URL: https://issues.apache.org/jira/browse/IVY-541
             Project: Ivy
          Issue Type: Bug
          Components: Core
    Affects Versions: 1.4.1
         Environment: NA
            Reporter: Oystein Aadland


When modules that uses the same dependencies with different configuration(or different includes) then only the first module that is resolved gets the artifacts that it specifies. The other gets what was last resolved.

Module A that uses module B.
Module B uses a build configuration of module C
Module A uses a build configuration of module C and a runtime configuration
of module B

Module B downloads explicit jars from C depending on configuration.

When I resolve A in build configuration I only get the explicit defined
runtime jars that B defines for module C.

Here are snippets of the ivy files.

Module A:
...
<dependencies>
  <dependency org="myorg" name="B" rev="1.6" conf="build->runtime" />
  <dependency org="myorg" name="C" rev="1.10" conf="build,runtime->default"
/>
</dependencies>
...

Module B
...
<configurations>
    <conf name="build" visibility="private"/>
    <conf name="runtime"/>
</configurations>
<dependencies>
  <dependency org="myorg" name="C" rev="1.10" conf="build,runtime->default">
      <artifact name="art1" type="jar" conf="runtime"/>
      <artifact name="art2" type="jar" conf="runtime"/>
      <artifact name="art3" type="jar" conf="runtime"/>
  </dependency>
</dependencies>
...

Module C
...
<publications>
        <artifact name="art1" type="jar" conf="default"/>
        <artifact name="art2" type="jar" conf="default"/>
        <artifact name="art3" type="jar" conf="default"/>
        <artifact name="art4" type="jar" conf="default"/>
</publications>
...

If module A had explicitly added the artifacts that it needed for module C it would have worked fine. The way it should work is that if no specific artifacts are included, the all artifacts for the given configuration should have been included.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (IVY-541) Transitive dependencies resolves incorrectly when different modules uses the same dependency with different configurations in the same build

Posted by "Oystein Aadland (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IVY-541?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508138 ] 

Oystein Aadland edited comment on IVY-541 at 6/26/07 3:28 AM:
--------------------------------------------------------------

Added modifed source file for review


 was:
Modifed source file for review

> Transitive dependencies resolves incorrectly when different modules uses the same dependency with different configurations in the same build
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: IVY-541
>                 URL: https://issues.apache.org/jira/browse/IVY-541
>             Project: Ivy
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.4.1
>         Environment: NA
>            Reporter: Oystein Aadland
>         Attachments: IvyNode.java
>
>
> When modules that uses the same dependencies with different configuration(or different includes) then only the first module that is resolved gets the artifacts that it specifies. The other gets what was last resolved.
> Module A that uses module B.
> Module B uses a build configuration of module C
> Module A uses a build configuration of module C and a runtime configuration
> of module B
> Module B downloads explicit jars from C depending on configuration.
> When I resolve A in build configuration I only get the explicit defined
> runtime jars that B defines for module C.
> Here are snippets of the ivy files.
> Module A:
> ...
> <dependencies>
>   <dependency org="myorg" name="B" rev="1.6" conf="build->runtime" />
>   <dependency org="myorg" name="C" rev="1.10" conf="build,runtime->default"
> />
> </dependencies>
> ...
> Module B
> ...
> <configurations>
>     <conf name="build" visibility="private"/>
>     <conf name="runtime"/>
> </configurations>
> <dependencies>
>   <dependency org="myorg" name="C" rev="1.10" conf="build,runtime->default">
>       <artifact name="art1" type="jar" conf="runtime"/>
>       <artifact name="art2" type="jar" conf="runtime"/>
>       <artifact name="art3" type="jar" conf="runtime"/>
>   </dependency>
> </dependencies>
> ...
> Module C
> ...
> <publications>
>         <artifact name="art1" type="jar" conf="default"/>
>         <artifact name="art2" type="jar" conf="default"/>
>         <artifact name="art3" type="jar" conf="default"/>
>         <artifact name="art4" type="jar" conf="default"/>
> </publications>
> ...
> If module A had explicitly added the artifacts that it needed for module C it would have worked fine. The way it should work is that if no specific artifacts are included, the all artifacts for the given configuration should have been included.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (IVY-541) Transitive dependencies resolves incorrectly when different modules uses the same dependency with different configurations in the same build

Posted by "Oystein Aadland (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IVY-541?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508136 ] 

Oystein Aadland edited comment on IVY-541 at 6/26/07 3:29 AM:
--------------------------------------------------------------

Well. JIRA seriously messed up the formatting in my last post. Adding the modified source file. 


 was:
Well. JIRA seriously messed up the formatting in my last formatting. Adding the modified source file. 

> Transitive dependencies resolves incorrectly when different modules uses the same dependency with different configurations in the same build
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: IVY-541
>                 URL: https://issues.apache.org/jira/browse/IVY-541
>             Project: Ivy
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.4.1
>         Environment: NA
>            Reporter: Oystein Aadland
>         Attachments: IvyNode.java
>
>
> When modules that uses the same dependencies with different configuration(or different includes) then only the first module that is resolved gets the artifacts that it specifies. The other gets what was last resolved.
> Module A that uses module B.
> Module B uses a build configuration of module C
> Module A uses a build configuration of module C and a runtime configuration
> of module B
> Module B downloads explicit jars from C depending on configuration.
> When I resolve A in build configuration I only get the explicit defined
> runtime jars that B defines for module C.
> Here are snippets of the ivy files.
> Module A:
> ...
> <dependencies>
>   <dependency org="myorg" name="B" rev="1.6" conf="build->runtime" />
>   <dependency org="myorg" name="C" rev="1.10" conf="build,runtime->default"
> />
> </dependencies>
> ...
> Module B
> ...
> <configurations>
>     <conf name="build" visibility="private"/>
>     <conf name="runtime"/>
> </configurations>
> <dependencies>
>   <dependency org="myorg" name="C" rev="1.10" conf="build,runtime->default">
>       <artifact name="art1" type="jar" conf="runtime"/>
>       <artifact name="art2" type="jar" conf="runtime"/>
>       <artifact name="art3" type="jar" conf="runtime"/>
>   </dependency>
> </dependencies>
> ...
> Module C
> ...
> <publications>
>         <artifact name="art1" type="jar" conf="default"/>
>         <artifact name="art2" type="jar" conf="default"/>
>         <artifact name="art3" type="jar" conf="default"/>
>         <artifact name="art4" type="jar" conf="default"/>
> </publications>
> ...
> If module A had explicitly added the artifacts that it needed for module C it would have worked fine. The way it should work is that if no specific artifacts are included, the all artifacts for the given configuration should have been included.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (IVY-541) Transitive dependencies resolves incorrectly when different modules uses the same dependency with different configurations in the same build

Posted by "Oystein Aadland (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IVY-541?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508135 ] 

Oystein Aadland commented on IVY-541:
-------------------------------------

I think that I have identified the offending code. The problem lies in IvyNode.loadData() line 704. This line only adds artifacts specifically included and not all if none is specified. So I propose changing the code from:

<--- CLIP
        DependencyDescriptor dd = getDependencyDescriptor(getParent());
        if (dd != null) {
            addDependencyArtifactsIncludes(_rootModuleConf, dd.getDependencyArtifactsIncludes(getParentConf())); // LINE 704
        }
<--- CLIP 

To: 

<--- CLIP 
       DependencyDescriptor dd = getDependencyDescriptor(getParent());
        if (dd != null) {
            DependencyArtifactDescriptor[] deps = dd.getDependencyArtifactsIncludes(getParentConf());
            if (deps.length == 0 && _md != null) {
              deps = getDefaultIncludedForConfiguration(dd);
            }
            addDependencyArtifactsIncludes(_rootModuleConf, deps);

        }

...

private DependencyArtifactDescriptor[] getDefaultIncludedForConfiguration(DependencyDescriptor dd) {
    DependencyArtifactDescriptor[] deps;
    Artifact[] arts = _md.getArtifacts(getRootModuleConf());
    deps = new DependencyArtifactDescriptor[arts.length];
    for (int i=0; i<arts.length; i++) {
      Artifact art = arts[i];
      DefaultDependencyArtifactDescriptor ddad = new DefaultDependencyArtifactDescriptor(
          new DefaultDependencyDescriptor(_md, _md.getModuleRevisionId(), dd.isForce(), dd.isChanging(), dd.isTransitive()),
          art.getName(),
          art.getType(),
          art.getExt(),
          true,
          ExactPatternMatcher.getInstance()
      );
      ddad.addConfiguration(getRootModuleConf());
      deps[i] = ddad;
    }
    return deps;
}

<--- CLIP 

This worked in my case, but please understand that I am not very familiar with the ivy source so I might have missed some other important point. Anyway, it's probably a good start. 

> Transitive dependencies resolves incorrectly when different modules uses the same dependency with different configurations in the same build
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: IVY-541
>                 URL: https://issues.apache.org/jira/browse/IVY-541
>             Project: Ivy
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.4.1
>         Environment: NA
>            Reporter: Oystein Aadland
>
> When modules that uses the same dependencies with different configuration(or different includes) then only the first module that is resolved gets the artifacts that it specifies. The other gets what was last resolved.
> Module A that uses module B.
> Module B uses a build configuration of module C
> Module A uses a build configuration of module C and a runtime configuration
> of module B
> Module B downloads explicit jars from C depending on configuration.
> When I resolve A in build configuration I only get the explicit defined
> runtime jars that B defines for module C.
> Here are snippets of the ivy files.
> Module A:
> ...
> <dependencies>
>   <dependency org="myorg" name="B" rev="1.6" conf="build->runtime" />
>   <dependency org="myorg" name="C" rev="1.10" conf="build,runtime->default"
> />
> </dependencies>
> ...
> Module B
> ...
> <configurations>
>     <conf name="build" visibility="private"/>
>     <conf name="runtime"/>
> </configurations>
> <dependencies>
>   <dependency org="myorg" name="C" rev="1.10" conf="build,runtime->default">
>       <artifact name="art1" type="jar" conf="runtime"/>
>       <artifact name="art2" type="jar" conf="runtime"/>
>       <artifact name="art3" type="jar" conf="runtime"/>
>   </dependency>
> </dependencies>
> ...
> Module C
> ...
> <publications>
>         <artifact name="art1" type="jar" conf="default"/>
>         <artifact name="art2" type="jar" conf="default"/>
>         <artifact name="art3" type="jar" conf="default"/>
>         <artifact name="art4" type="jar" conf="default"/>
> </publications>
> ...
> If module A had explicitly added the artifacts that it needed for module C it would have worked fine. The way it should work is that if no specific artifacts are included, the all artifacts for the given configuration should have been included.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (IVY-541) Transitive dependencies resolves incorrectly when different modules uses the same dependency with different configurations in the same build

Posted by "Oystein Aadland (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IVY-541?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508136 ] 

Oystein Aadland commented on IVY-541:
-------------------------------------

Well. JIRA seriously messed up the formatting in my last formatting. Adding the modified source file. 

> Transitive dependencies resolves incorrectly when different modules uses the same dependency with different configurations in the same build
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: IVY-541
>                 URL: https://issues.apache.org/jira/browse/IVY-541
>             Project: Ivy
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.4.1
>         Environment: NA
>            Reporter: Oystein Aadland
>
> When modules that uses the same dependencies with different configuration(or different includes) then only the first module that is resolved gets the artifacts that it specifies. The other gets what was last resolved.
> Module A that uses module B.
> Module B uses a build configuration of module C
> Module A uses a build configuration of module C and a runtime configuration
> of module B
> Module B downloads explicit jars from C depending on configuration.
> When I resolve A in build configuration I only get the explicit defined
> runtime jars that B defines for module C.
> Here are snippets of the ivy files.
> Module A:
> ...
> <dependencies>
>   <dependency org="myorg" name="B" rev="1.6" conf="build->runtime" />
>   <dependency org="myorg" name="C" rev="1.10" conf="build,runtime->default"
> />
> </dependencies>
> ...
> Module B
> ...
> <configurations>
>     <conf name="build" visibility="private"/>
>     <conf name="runtime"/>
> </configurations>
> <dependencies>
>   <dependency org="myorg" name="C" rev="1.10" conf="build,runtime->default">
>       <artifact name="art1" type="jar" conf="runtime"/>
>       <artifact name="art2" type="jar" conf="runtime"/>
>       <artifact name="art3" type="jar" conf="runtime"/>
>   </dependency>
> </dependencies>
> ...
> Module C
> ...
> <publications>
>         <artifact name="art1" type="jar" conf="default"/>
>         <artifact name="art2" type="jar" conf="default"/>
>         <artifact name="art3" type="jar" conf="default"/>
>         <artifact name="art4" type="jar" conf="default"/>
> </publications>
> ...
> If module A had explicitly added the artifacts that it needed for module C it would have worked fine. The way it should work is that if no specific artifacts are included, the all artifacts for the given configuration should have been included.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (IVY-541) Transitive dependencies resolves incorrectly when different modules uses the same dependency with different configurations in the same build

Posted by "Oystein Aadland (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IVY-541?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12523500 ] 

Oystein Aadland commented on IVY-541:
-------------------------------------

Sorry for the delay. Yes the fix is for 1.4.1.

> Transitive dependencies resolves incorrectly when different modules uses the same dependency with different configurations in the same build
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: IVY-541
>                 URL: https://issues.apache.org/jira/browse/IVY-541
>             Project: Ivy
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.4.1
>         Environment: NA
>            Reporter: Oystein Aadland
>         Attachments: IvyNode.java
>
>
> When modules that uses the same dependencies with different configuration(or different includes) then only the first module that is resolved gets the artifacts that it specifies. The other gets what was last resolved.
> Module A that uses module B.
> Module B uses a build configuration of module C
> Module A uses a build configuration of module C and a runtime configuration
> of module B
> Module B downloads explicit jars from C depending on configuration.
> When I resolve A in build configuration I only get the explicit defined
> runtime jars that B defines for module C.
> Here are snippets of the ivy files.
> Module A:
> ...
> <dependencies>
>   <dependency org="myorg" name="B" rev="1.6" conf="build->runtime" />
>   <dependency org="myorg" name="C" rev="1.10" conf="build,runtime->default"
> />
> </dependencies>
> ...
> Module B
> ...
> <configurations>
>     <conf name="build" visibility="private"/>
>     <conf name="runtime"/>
> </configurations>
> <dependencies>
>   <dependency org="myorg" name="C" rev="1.10" conf="build,runtime->default">
>       <artifact name="art1" type="jar" conf="runtime"/>
>       <artifact name="art2" type="jar" conf="runtime"/>
>       <artifact name="art3" type="jar" conf="runtime"/>
>   </dependency>
> </dependencies>
> ...
> Module C
> ...
> <publications>
>         <artifact name="art1" type="jar" conf="default"/>
>         <artifact name="art2" type="jar" conf="default"/>
>         <artifact name="art3" type="jar" conf="default"/>
>         <artifact name="art4" type="jar" conf="default"/>
> </publications>
> ...
> If module A had explicitly added the artifacts that it needed for module C it would have worked fine. The way it should work is that if no specific artifacts are included, the all artifacts for the given configuration should have been included.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (IVY-541) Transitive dependencies resolves incorrectly when different modules uses the same dependency with different configurations in the same build

Posted by "Oystein Aadland (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IVY-541?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508135 ] 

Oystein Aadland edited comment on IVY-541 at 6/26/07 3:23 AM:
--------------------------------------------------------------

I think that I have identified the offending code. The problem lies in IvyNode.loadData() line 704. This line only adds artifacts specifically included and not all if none is specified. So I propose changing the code from:
<verbatim>
<--- CLIP
        DependencyDescriptor dd = getDependencyDescriptor(getParent());
        if (dd != null) {
            addDependencyArtifactsIncludes(_rootModuleConf, dd.getDependencyArtifactsIncludes(getParentConf())); // LINE 704
        }
<--- CLIP 

To: 

<--- CLIP 
       DependencyDescriptor dd = getDependencyDescriptor(getParent());
        if (dd != null) {
            DependencyArtifactDescriptor[] deps = dd.getDependencyArtifactsIncludes(getParentConf());
            if (deps.length == 0 && _md != null) {
              deps = getDefaultIncludedForConfiguration(dd);
            }
            addDependencyArtifactsIncludes(_rootModuleConf, deps);

        }

...

private DependencyArtifactDescriptor[] getDefaultIncludedForConfiguration(DependencyDescriptor dd) {
    DependencyArtifactDescriptor[] deps;
    Artifact[] arts = _md.getArtifacts(getRootModuleConf());
    deps = new DependencyArtifactDescriptor[arts.length];
    for (int i=0; i<arts.length; i++) {
      Artifact art = arts[i];
      DefaultDependencyArtifactDescriptor ddad = new DefaultDependencyArtifactDescriptor(
          new DefaultDependencyDescriptor(_md, _md.getModuleRevisionId(), dd.isForce(), dd.isChanging(), dd.isTransitive()),
          art.getName(),
          art.getType(),
          art.getExt(),
          true,
          ExactPatternMatcher.getInstance()
      );
      ddad.addConfiguration(getRootModuleConf());
      deps[i] = ddad;
    }
    return deps;
}

<--- CLIP 
</verbatim>
This worked in my case, but please understand that I am not very familiar with the ivy source so I might have missed some other important point. Anyway, it's probably a good start. 


 was:
I think that I have identified the offending code. The problem lies in IvyNode.loadData() line 704. This line only adds artifacts specifically included and not all if none is specified. So I propose changing the code from:

<--- CLIP
        DependencyDescriptor dd = getDependencyDescriptor(getParent());
        if (dd != null) {
            addDependencyArtifactsIncludes(_rootModuleConf, dd.getDependencyArtifactsIncludes(getParentConf())); // LINE 704
        }
<--- CLIP 

To: 

<--- CLIP 
       DependencyDescriptor dd = getDependencyDescriptor(getParent());
        if (dd != null) {
            DependencyArtifactDescriptor[] deps = dd.getDependencyArtifactsIncludes(getParentConf());
            if (deps.length == 0 && _md != null) {
              deps = getDefaultIncludedForConfiguration(dd);
            }
            addDependencyArtifactsIncludes(_rootModuleConf, deps);

        }

...

private DependencyArtifactDescriptor[] getDefaultIncludedForConfiguration(DependencyDescriptor dd) {
    DependencyArtifactDescriptor[] deps;
    Artifact[] arts = _md.getArtifacts(getRootModuleConf());
    deps = new DependencyArtifactDescriptor[arts.length];
    for (int i=0; i<arts.length; i++) {
      Artifact art = arts[i];
      DefaultDependencyArtifactDescriptor ddad = new DefaultDependencyArtifactDescriptor(
          new DefaultDependencyDescriptor(_md, _md.getModuleRevisionId(), dd.isForce(), dd.isChanging(), dd.isTransitive()),
          art.getName(),
          art.getType(),
          art.getExt(),
          true,
          ExactPatternMatcher.getInstance()
      );
      ddad.addConfiguration(getRootModuleConf());
      deps[i] = ddad;
    }
    return deps;
}

<--- CLIP 

This worked in my case, but please understand that I am not very familiar with the ivy source so I might have missed some other important point. Anyway, it's probably a good start. 

> Transitive dependencies resolves incorrectly when different modules uses the same dependency with different configurations in the same build
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: IVY-541
>                 URL: https://issues.apache.org/jira/browse/IVY-541
>             Project: Ivy
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.4.1
>         Environment: NA
>            Reporter: Oystein Aadland
>
> When modules that uses the same dependencies with different configuration(or different includes) then only the first module that is resolved gets the artifacts that it specifies. The other gets what was last resolved.
> Module A that uses module B.
> Module B uses a build configuration of module C
> Module A uses a build configuration of module C and a runtime configuration
> of module B
> Module B downloads explicit jars from C depending on configuration.
> When I resolve A in build configuration I only get the explicit defined
> runtime jars that B defines for module C.
> Here are snippets of the ivy files.
> Module A:
> ...
> <dependencies>
>   <dependency org="myorg" name="B" rev="1.6" conf="build->runtime" />
>   <dependency org="myorg" name="C" rev="1.10" conf="build,runtime->default"
> />
> </dependencies>
> ...
> Module B
> ...
> <configurations>
>     <conf name="build" visibility="private"/>
>     <conf name="runtime"/>
> </configurations>
> <dependencies>
>   <dependency org="myorg" name="C" rev="1.10" conf="build,runtime->default">
>       <artifact name="art1" type="jar" conf="runtime"/>
>       <artifact name="art2" type="jar" conf="runtime"/>
>       <artifact name="art3" type="jar" conf="runtime"/>
>   </dependency>
> </dependencies>
> ...
> Module C
> ...
> <publications>
>         <artifact name="art1" type="jar" conf="default"/>
>         <artifact name="art2" type="jar" conf="default"/>
>         <artifact name="art3" type="jar" conf="default"/>
>         <artifact name="art4" type="jar" conf="default"/>
> </publications>
> ...
> If module A had explicitly added the artifacts that it needed for module C it would have worked fine. The way it should work is that if no specific artifacts are included, the all artifacts for the given configuration should have been included.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (IVY-541) Transitive dependencies resolves incorrectly when different modules uses the same dependency with different configurations in the same build

Posted by "Oystein Aadland (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IVY-541?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508135 ] 

Oystein Aadland edited comment on IVY-541 at 6/26/07 3:24 AM:
--------------------------------------------------------------

I think that I have identified the offending code. The problem lies in IvyNode.loadData() line 704. This line only adds artifacts specifically included and not all if none is specified. So I propose changing the code from:

<--- CLIP
        DependencyDescriptor dd = getDependencyDescriptor(getParent());
        if (dd != null) {
            addDependencyArtifactsIncludes(_rootModuleConf, dd.getDependencyArtifactsIncludes(getParentConf())); // LINE 704
        }
<--- CLIP 

To: 

<--- CLIP 
       DependencyDescriptor dd = getDependencyDescriptor(getParent());
        if (dd != null) {
            DependencyArtifactDescriptor[] deps = dd.getDependencyArtifactsIncludes(getParentConf());
            if (deps.length == 0 && _md != null) {
              deps = getDefaultIncludedForConfiguration(dd);
            }
            addDependencyArtifactsIncludes(_rootModuleConf, deps);

        }

...

private DependencyArtifactDescriptor[] getDefaultIncludedForConfiguration(DependencyDescriptor dd) {
    DependencyArtifactDescriptor[] deps;
    Artifact[] arts = _md.getArtifacts(getRootModuleConf());
    deps = new DependencyArtifactDescriptor[arts.length];
    for (int i=0; i<arts.length; i++) {
      Artifact art = arts[i];
      DefaultDependencyArtifactDescriptor ddad = new DefaultDependencyArtifactDescriptor(
          new DefaultDependencyDescriptor(_md, _md.getModuleRevisionId(), dd.isForce(), dd.isChanging(), dd.isTransitive()),
          art.getName(),
          art.getType(),
          art.getExt(),
          true,
          ExactPatternMatcher.getInstance()
      );
      ddad.addConfiguration(getRootModuleConf());
      deps[i] = ddad;
    }
    return deps;
}

<--- CLIP 

This worked in my case, but please understand that I am not very familiar with the ivy source so I might have missed some other important point. Anyway, it's probably a good start. 


 was:
I think that I have identified the offending code. The problem lies in IvyNode.loadData() line 704. This line only adds artifacts specifically included and not all if none is specified. So I propose changing the code from:
<verbatim>
<--- CLIP
        DependencyDescriptor dd = getDependencyDescriptor(getParent());
        if (dd != null) {
            addDependencyArtifactsIncludes(_rootModuleConf, dd.getDependencyArtifactsIncludes(getParentConf())); // LINE 704
        }
<--- CLIP 

To: 

<--- CLIP 
       DependencyDescriptor dd = getDependencyDescriptor(getParent());
        if (dd != null) {
            DependencyArtifactDescriptor[] deps = dd.getDependencyArtifactsIncludes(getParentConf());
            if (deps.length == 0 && _md != null) {
              deps = getDefaultIncludedForConfiguration(dd);
            }
            addDependencyArtifactsIncludes(_rootModuleConf, deps);

        }

...

private DependencyArtifactDescriptor[] getDefaultIncludedForConfiguration(DependencyDescriptor dd) {
    DependencyArtifactDescriptor[] deps;
    Artifact[] arts = _md.getArtifacts(getRootModuleConf());
    deps = new DependencyArtifactDescriptor[arts.length];
    for (int i=0; i<arts.length; i++) {
      Artifact art = arts[i];
      DefaultDependencyArtifactDescriptor ddad = new DefaultDependencyArtifactDescriptor(
          new DefaultDependencyDescriptor(_md, _md.getModuleRevisionId(), dd.isForce(), dd.isChanging(), dd.isTransitive()),
          art.getName(),
          art.getType(),
          art.getExt(),
          true,
          ExactPatternMatcher.getInstance()
      );
      ddad.addConfiguration(getRootModuleConf());
      deps[i] = ddad;
    }
    return deps;
}

<--- CLIP 
</verbatim>
This worked in my case, but please understand that I am not very familiar with the ivy source so I might have missed some other important point. Anyway, it's probably a good start. 

> Transitive dependencies resolves incorrectly when different modules uses the same dependency with different configurations in the same build
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: IVY-541
>                 URL: https://issues.apache.org/jira/browse/IVY-541
>             Project: Ivy
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.4.1
>         Environment: NA
>            Reporter: Oystein Aadland
>
> When modules that uses the same dependencies with different configuration(or different includes) then only the first module that is resolved gets the artifacts that it specifies. The other gets what was last resolved.
> Module A that uses module B.
> Module B uses a build configuration of module C
> Module A uses a build configuration of module C and a runtime configuration
> of module B
> Module B downloads explicit jars from C depending on configuration.
> When I resolve A in build configuration I only get the explicit defined
> runtime jars that B defines for module C.
> Here are snippets of the ivy files.
> Module A:
> ...
> <dependencies>
>   <dependency org="myorg" name="B" rev="1.6" conf="build->runtime" />
>   <dependency org="myorg" name="C" rev="1.10" conf="build,runtime->default"
> />
> </dependencies>
> ...
> Module B
> ...
> <configurations>
>     <conf name="build" visibility="private"/>
>     <conf name="runtime"/>
> </configurations>
> <dependencies>
>   <dependency org="myorg" name="C" rev="1.10" conf="build,runtime->default">
>       <artifact name="art1" type="jar" conf="runtime"/>
>       <artifact name="art2" type="jar" conf="runtime"/>
>       <artifact name="art3" type="jar" conf="runtime"/>
>   </dependency>
> </dependencies>
> ...
> Module C
> ...
> <publications>
>         <artifact name="art1" type="jar" conf="default"/>
>         <artifact name="art2" type="jar" conf="default"/>
>         <artifact name="art3" type="jar" conf="default"/>
>         <artifact name="art4" type="jar" conf="default"/>
> </publications>
> ...
> If module A had explicitly added the artifacts that it needed for module C it would have worked fine. The way it should work is that if no specific artifacts are included, the all artifacts for the given configuration should have been included.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (IVY-541) Transitive dependencies resolves incorrectly when different modules uses the same dependency with different configurations in the same build

Posted by "Oystein Aadland (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IVY-541?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oystein Aadland updated IVY-541:
--------------------------------

    Attachment: IvyNode.java

Modifed source file for review

> Transitive dependencies resolves incorrectly when different modules uses the same dependency with different configurations in the same build
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: IVY-541
>                 URL: https://issues.apache.org/jira/browse/IVY-541
>             Project: Ivy
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.4.1
>         Environment: NA
>            Reporter: Oystein Aadland
>         Attachments: IvyNode.java
>
>
> When modules that uses the same dependencies with different configuration(or different includes) then only the first module that is resolved gets the artifacts that it specifies. The other gets what was last resolved.
> Module A that uses module B.
> Module B uses a build configuration of module C
> Module A uses a build configuration of module C and a runtime configuration
> of module B
> Module B downloads explicit jars from C depending on configuration.
> When I resolve A in build configuration I only get the explicit defined
> runtime jars that B defines for module C.
> Here are snippets of the ivy files.
> Module A:
> ...
> <dependencies>
>   <dependency org="myorg" name="B" rev="1.6" conf="build->runtime" />
>   <dependency org="myorg" name="C" rev="1.10" conf="build,runtime->default"
> />
> </dependencies>
> ...
> Module B
> ...
> <configurations>
>     <conf name="build" visibility="private"/>
>     <conf name="runtime"/>
> </configurations>
> <dependencies>
>   <dependency org="myorg" name="C" rev="1.10" conf="build,runtime->default">
>       <artifact name="art1" type="jar" conf="runtime"/>
>       <artifact name="art2" type="jar" conf="runtime"/>
>       <artifact name="art3" type="jar" conf="runtime"/>
>   </dependency>
> </dependencies>
> ...
> Module C
> ...
> <publications>
>         <artifact name="art1" type="jar" conf="default"/>
>         <artifact name="art2" type="jar" conf="default"/>
>         <artifact name="art3" type="jar" conf="default"/>
>         <artifact name="art4" type="jar" conf="default"/>
> </publications>
> ...
> If module A had explicitly added the artifacts that it needed for module C it would have worked fine. The way it should work is that if no specific artifacts are included, the all artifacts for the given configuration should have been included.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (IVY-541) Transitive dependencies resolves incorrectly when different modules uses the same dependency with different configurations in the same build

Posted by "Xavier Hanin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IVY-541?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508161 ] 

Xavier Hanin commented on IVY-541:
----------------------------------

Just to be sure, against which version of IvyNode have you made your modifications? 1.4.1?

> Transitive dependencies resolves incorrectly when different modules uses the same dependency with different configurations in the same build
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: IVY-541
>                 URL: https://issues.apache.org/jira/browse/IVY-541
>             Project: Ivy
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.4.1
>         Environment: NA
>            Reporter: Oystein Aadland
>         Attachments: IvyNode.java
>
>
> When modules that uses the same dependencies with different configuration(or different includes) then only the first module that is resolved gets the artifacts that it specifies. The other gets what was last resolved.
> Module A that uses module B.
> Module B uses a build configuration of module C
> Module A uses a build configuration of module C and a runtime configuration
> of module B
> Module B downloads explicit jars from C depending on configuration.
> When I resolve A in build configuration I only get the explicit defined
> runtime jars that B defines for module C.
> Here are snippets of the ivy files.
> Module A:
> ...
> <dependencies>
>   <dependency org="myorg" name="B" rev="1.6" conf="build->runtime" />
>   <dependency org="myorg" name="C" rev="1.10" conf="build,runtime->default"
> />
> </dependencies>
> ...
> Module B
> ...
> <configurations>
>     <conf name="build" visibility="private"/>
>     <conf name="runtime"/>
> </configurations>
> <dependencies>
>   <dependency org="myorg" name="C" rev="1.10" conf="build,runtime->default">
>       <artifact name="art1" type="jar" conf="runtime"/>
>       <artifact name="art2" type="jar" conf="runtime"/>
>       <artifact name="art3" type="jar" conf="runtime"/>
>   </dependency>
> </dependencies>
> ...
> Module C
> ...
> <publications>
>         <artifact name="art1" type="jar" conf="default"/>
>         <artifact name="art2" type="jar" conf="default"/>
>         <artifact name="art3" type="jar" conf="default"/>
>         <artifact name="art4" type="jar" conf="default"/>
> </publications>
> ...
> If module A had explicitly added the artifacts that it needed for module C it would have worked fine. The way it should work is that if no specific artifacts are included, the all artifacts for the given configuration should have been included.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.