Hi,

Here's what we do in the Gradle build (more or less):

We use a custom dependency configuration which we add the test jar to. To create and publish the jar we do:

configurations {
    testFixtures {
        extendsFrom testRuntime
    }
}

task testJar(type: Jar) {
    from sourceSets.test.classes
    classifier = 'test'
}

artifacts {
    testFixtures testJar
}

To use the jar we do:

dependencies {
    testCompile project(path: ':project1', configuration: 'testFixtures')
}


Using a configuration allows the dependencies of the test jar to be included in the testCompile classpath.


On 1/02/10 3:40 AM, Timo Meinen | mindmatters wrote:
Hi,

I converted our OSS framework from Maven to Gradle today. And it was really a smooth transition. I just have 2 problems. The first one is how to compile AspectJ files. But i will suspend this problem for a while.

The second one is about testCompile dependencies to a sibling project in a multi-project setup. Wow - that sounds weird. So, I try to make some ASCII-art:

project
|-project1
|--build/test-classes
|-project2

The problem is, that project2 needs the test-classes as a testCompile dependency.

In Maven I created a test-jar of project1 with a "tests" classifier. So project2 could declare the dependency like this:

<dependency>
<groupId>com.example</groupId>
<artifactId>project1</artifactId>
<version>1.0-SNAPSHOT</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>


I tried this, but it didn't work:

dependencies {
  compile project(':project1')
  testCompile project(':project1')
}

Is there something like a classifier available?

Thank you very much
Timo Meinen
[email protected]

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



--
Adam Murdoch
Gradle Developer
http://www.gradle.org


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to