I have the following directory structure:
dir
|
|---project1
| |
| |--build.gradle
| |--src/main/java/com/bpd/app
| |
| |--SomeClass.java
|
|---project2
|
|--build.gradle
|--src/main/java/com/bpd/app
|
|--AnotherClass.java
|--MyClass.java
Both are separate Java projects, but SomeClass
will not compile because it cannot find MyClass
.
I can add project2
to the build path for project1
using Eclipse (and SomeClass
will then compile), but I want to know how to do it using Gradle. Is it possible? How can I make Gradle add project2
to the build path for project1
?
Here's the build.gradle
file for one of the projects. Only the library dependencies differ.
apply plugin: 'java'
apply plugin: 'eclipse-wtp'
apply plugin: 'war'
apply plugin: 'checkstyle'
apply plugin: 'pmd'
apply plugin: 'findbugs'
apply plugin: 'jacoco'
repositories {
mavenCentral()
}
dependencies {
compile "javax.ws.rs:jsr311-api:1.1.1"
compile 'com.sun.jersey:jersey-server:1.13'
compile 'com.sun.jersey:jersey-core:1.13'
compile 'com.sun.jersey:jersey-servlet:1.13'
compile 'com.sun.jersey:jersey-json:1.13'
compile 'javax.ejb:ejb-api:3.0'
compile 'org.eclipse.persistence:javax.persistence:2.0.0'
compile 'org.eclipse.persistence:org.eclipse.persistence.jpa:2.6.2'
compile 'org.xerial:sqlite-jdbc:3.8.11.2'
testCompile 'junit:junit:4.12'
testCompile 'org.assertj:assertj-core:3.2.0'
}
sourceSets.test.resources {
srcDirs = ["src/test/java", "src/test/resources"]
exclude "**/package-info.java"
}
jar {
from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
tasks.withType(FindBugs) {
reports {
xml.enabled = false
html.enabled = true
}
}
checkstyle {
toolVersion = "6.13"
}