That bug may be related to what I'm experiencing, but it's not the same. The
bug report explicitly says "given util-1.0-testutil.jar is *not* resolvable"
- but in my case, both archives *are* resolvable.

I'd be perfectly happy to create a different artifact, but I haven't been
able to figure out the right way to do it.

The best I've been able to come up with is

> task jarTests(type: Jar, dependsOn: testClasses) {
>   classifier = 'tests'
>   appendix = 'tests'
>   from sourceSets.test.classes
> }
>
> artifacts {
>   archives jarTests
> }
>
> install {
>   repositories.mavenInstaller {
>     addFilter('tests') { artifact, file -> println artifact.name;
> artifact.name ==~ '.*-tests'}
>   }
>

This sort of works - it creates a new "foo-tests" artifact with
foo-tests-1.0-SNAPSHOT-tests.jar. However, it still installs the file under
"foo" as foo-1.0-SNAPSHOT-tests.jar, and it fails to create a POM for the
"foo-tests" artifact.

Before anyone asks, if I remove the classifier, it breaks. Since it's still
placing the tests archive into the foo artifact, if I remove the classifier,
there's a conflict.

I know that if I remove jarTests from the archives configuration that it
won't get installed into the foo artifact. How do I still get it installed
into the foo-tests artifact, and how do I generate the POM for it?

Thank you,
Adrian

On Mon, Jul 11, 2011 at 7:13 PM, Szczepan Faber <[email protected]> wrote:

> Hey
>
> Yes, it's a bug: http://issues.gradle.org/browse/GRADLE-1442
>
> In your case the workaround is to produce a different artifact. It is
> more natural approach anyway IMHO.
>
> Cheers!
> Szczepan
>
> On Mon, Jul 11, 2011 at 10:31 PM, Merlyn Albery-Speyer
> <[email protected]> wrote:
> > Hmm.
> >
> > All: Is this a known bug?
> >
> > On Jul 11, 2011 12:37 PM, "Adrian Abraham" <[email protected]>
> wrote:
> >> Merlyn,
> >>
> >> I've changed the dependencies block to:
> >>
> >>> dependencies {
> >>> compile group: 'foo', name: 'foo', version: '1.0-SNAPSHOT'
> >>> testCompile group: 'foo', name: 'foo', version: '1.0-SNAPSHOT'
> >>> testCompile group: 'foo', name: 'foo', version: '1.0-SNAPSHOT',
> >>> classifier: 'tests'
> >>> testCompile group: 'junit', name: 'junit', version: '4.8.2'
> >>> }
> >>>
> >>
> >> I'm getting the exact same behavior as before. Whichever dependency
> comes
> >> second is the one which is put on the classpath.
> >>
> >> - Adrian
> >>
> >> On Mon, Jul 11, 2011 at 2:57 PM, Merlyn Albery-Speyer <
> >> [email protected]> wrote:
> >>
> >>> Hi Adrian, when you use dependencies with classifiers you need to use
> the
> >>> more verbose form that and provide the classifier like so:
> >>>
> >>> .... classifier: "test"
> >>> On Jul 11, 2011 11:51 AM, "Adrian Abraham" <[email protected]>
> >>> wrote:
> >>>
> >
>
>
>
> --
> Szczepan Faber
> Principal engineer@gradleware
> Lead@mockito
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

Reply via email to