I have a multi-project setup in maven and try to switch to gradle. I am trying to figure out how to have one dependency on a project, including another trial bank of the project. Right now I have the following in ProjectA:
packageTests = task packageTests(type: Jar) { classifier = 'tests' from sourceSets.test.output } tasks.getByPath(":ProjectA:jar").dependsOn(packageTests)
And in ProjectB, I have:
testCompile project(path: ':ProjectA', classifier: 'tests')
I see that my tests do not compile. It looks like they are missing classes defined in the test bank. When I check the build directory, I see that ProjectA-0.1.56-SNAPSHOT-tests.jar is present.
In maven, I had the following for ProjectA:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.4</version> <executions> <execution> <phase>package</phase> <goals> <goal>test-jar</goal> </goals> </execution> </executions> </plugin>
And this is for ProjectB:
<dependency> <groupId>com.example</groupId> <artifactId>ProjectA</artifactId> <version>0.1.56-SNAPSHOT</version> <type>test-jar</type> </dependency>
How can I make this work just like maven?
source share