-
-
Save vrudikov/d043778f5236d309b890b9413c9e71b9 to your computer and use it in GitHub Desktop.
Gradle multi-project build where project2's test classes depend on project1's test classes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. | |
├── build.gradle | |
├── project1 | |
│ ├── build.gradle | |
│ └── src | |
│ └── test | |
│ └── java | |
│ └── sample | |
│ └── Foo.java | |
├── project2 | |
│ ├── build.gradle | |
│ └── src | |
│ └── test | |
│ └── java | |
│ └── sample | |
│ └── BarTest.java | |
└── settings.gradle | |
== BarTest.java | |
package sample; | |
import org.junit.Test; | |
import static org.junit.Assert.*; | |
public class BarTest { | |
@Test | |
public void doit() { | |
assertNotNull(new Foo()); | |
} | |
} | |
== build.gradle (project1) | |
task testJar(type: Jar) { | |
classifier 'test' | |
from sourceSets.test.output | |
} | |
== build.gradle (project2) | |
dependencies { | |
compile project(':project1') | |
testCompile files(project(':project1').testJar.archivePath) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment