On 30/06/2011, at 6:19 PM, [email protected] wrote: > Hi guys, > I'm using Gradle 1.0 m3 and I have the following scenario - I'm defining a > dependency, but I would like to select only artifacts published in specific > remote configurations and want to define this in a single local configuration. > Since Gradle does not support specifying multiple remote configurations to > deliver for a single dependency, I specify the dependency twice (once for > each remote configuration whose artifacts I need): > > dependencies { > test ( > [ group: 'org.apache.log4j', name: 'log4j', version: '1.2.16', > configuration: 'archives' ], > [ group: 'org.apache.log4j', name: 'log4j', version: '1.2.16', > configuration: 'sources' ] > ) > } > > This works fine and eventually I get both the log4j binary and source > artifacts in test configuration, however I have a requirement to be able to > identify the module dependency that certain artifact was delivered by. For > this I'm using theResolvedConfiguration API, however when I inspect the two > resolved dependencies for their artifacts, I can see that Gradle assigns all > artifacts (binary and source) to both of them: > > Examining dependency [ group=org.apache.log4j, name=log4j, version=1.2.16, > configuration=archives ] ... > ... contains artifact [ name=log4j, type=jar, ext=jar ] > ... contains artifact [ name=log4j, type=source, ext=jar ] > Examining dependency [ group=org.apache.log4j, name=log4j, version=1.2.16, > configuration=sources ] ... > ... contains artifact [ name=log4j, type=jar, ext=jar ] > ... contains artifact [ name=log4j, type=source, ext=jar ] > > So I'm not able to tell where each artifact came from. > > I'm wondering whether this behavior is intentional, I'm attaching my sample > build script and repository so that you can verify this if you like (see > attached resolved-artifacts-test.zip). > > I spent some time trying to figure out the reason and identified a possible > solution for this - please see attached patch (against Gradle 1.0 m3 branch). > > I have tested it and it successfully fixes this issue, so I get expected > result: > > Examining dependency [ group=org.apache.log4j, name=log4j, version=1.2.16, > configuration=archives ] ... > ... contains artifact [ name=log4j, type=jar, ext=jar ] > Examining dependency [ group=org.apache.log4j, name=log4j, version=1.2.16, > configuration=sources ] ... > ... contains artifact [ name=log4j, type=source, ext=jar ] > > Do you think I should submit a bug report for this?
Yes please, and please attach the patch and sample app you originally posted. -- Luke Daley Principal Engineer, Gradleware http://gradleware.com
