Hey.
My project structure is something like.
/A
/B/C
/B/D
Project A
depends on C
and D
and D
depends on C
.
In settings.gradle of project A
I have declared
rootProject.name = 'A'
include ':C', ':D'
project(':C').projectDir = new File(settingsDir, '../B/C')
project(':D').projectDir = new File(settingsDir, '../B/D')
and in the build.gradle
of project A
implementation project(':C')
implementation project(':D')
It seems ok for project C
, while for project D
I get
Could not resolve project :D.
Required by:
project :
> Unable to find a matching configuration of project :D:
- None of the consumable configurations have attributes.
Project A
build.gradle
plugins {
id 'java'
id "io.freefair.lombok" version "5.0.0-rc6"
id 'eclipse'
}
apply plugin: 'java'
apply plugin: 'eclipse'
repositories {
mavenCentral()
}
sourceSets {
main {
java {
srcDirs = [ 'src/main', 'generated-sources/rpc-java' ]
}
}
test {
java {
srcDirs = [ 'src/test' ]
}
}
}
dependencies {
implementation project(':C')
implementation project(':D')
compileOnly "com.google.code.findbugs:jsr305:3.0.2"
compileOnly "org.eclipse.jdt:org.eclipse.jdt.annotation:2.2.100"
testCompileOnly "org.eclipse.jdt:org.eclipse.jdt.annotation:2.2.0"
}
compileJava.options.encoding = "UTF-8"
compileTestJava.options.encoding = "UTF-8"
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
Project C
build.gradle
plugins {
id 'java'
}
apply plugin: 'java'
apply plugin: 'eclipse'
repositories {
mavenCentral()
}
ext {
nettyVersion = '4.1.21.Final'
}
dependencies {
implementation"io.netty:netty-buffer:${nettyVersion}"
implementation"io.netty:netty-codec:${nettyVersion}"
implementation"io.netty:netty-common:${nettyVersion}"
implementation"io.netty:netty-handler:${nettyVersion}"
implementation"io.netty:netty-resolver:${nettyVersion}"
implementation"io.netty:netty-transport:${nettyVersion}"
compileOnly "javax.servlet:javax.servlet-api:3.1.0"
testImplementation "junit:junit:4.13"
implementation"org.msgpack:msgpack-core:0.8.19"
testCompileOnly "org.hamcrest:hamcrest-core:1.3"
compileOnly "org.eclipse.jdt:org.eclipse.jdt.annotation:2.2.100"
testCompileOnly "org.eclipse.jdt:org.eclipse.jdt.annotation:2.2.0"
testImplementation "org.apache.commons:commons-lang3:3.9"
}
compileJava.options.encoding = "UTF-8"
compileTestJava.options.encoding = "UTF-8"
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
jar {
from {
configurations.runtimeClasspath.findAll { it.name.endsWith('jar')}.collect { zipTree(it) }
}
from sourceSets.test.output
}
Project D
build.gradle
plugins {
id 'java'
}
repositories {
mavenCentral()
}
apply plugin: 'java'
apply plugin: 'eclipse'
dependencies {
implementation project(':C')
testImplementation "junit:junit:4.13"
testCompileOnly "org.hamcrest:hamcrest-core:1.3"
compileOnly "org.eclipse.jdt:org.eclipse.jdt.annotation:2.2.100"
testCompileOnly "org.eclipse.jdt:org.eclipse.jdt.annotation:2.2.0"
testImplementation "io.reactivex.rxjava2:rxjava:2.2.7"
testImplementation "org.slf4j:slf4j-api:1.7.30"
testImplementation "org.slf4j:slf4j-log4j12:1.7.30"
}
compileJava.options.encoding = "UTF-8"
compileTestJava.options.encoding = "UTF-8"
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
Project D
settings.gradle
rootProject.name = 'D'
include ':C''
project(':C').projectDir = new File(settingsDir, '../C')
Each of the projects have their own settings.gradle file.
Anything I should do in the settings or build file of any of those projects?
Using gradle 6.3 and AdoptOpenJDK 8.0.242