Greetings,
I have two sub projects, Core & Game, and I am trying to make it so project Game will build with project Core inside and all dependencies that are to be build inside of Cores jar, but NOT dependencies that are not supposed to be built into Cores jar.
My Core build.gradle is:
configurations {
includeInJar
}
dependencies {
compile fileTree(include: ['*.jar'], dir: '../Libraries')
// https://mvnrepository.com/artifact/org.apache.commons/commons-dbcp2
includeInJar group: 'org.apache.commons', name: 'commons-dbcp2', version: '2.1.1'
configurations.compile.extendsFrom(configurations.includeInJar)
}
jar {
from configurations.includeInJar.collect { zipTree it }
}
And my Game build.gradle is
configurations {
includeInJar
}
dependencies {
includeInJar project(':Core')
configurations.compile.extendsFrom(configurations.includeInJar)
}
jar {
from configurations.includeInJar.collect { zipTree it }
}
However when I build Game it builds all of Cores dependencies into it. All the dependencies in the ‘compile’ configuration, not just the ones in includeInJar.
Does anyone know how I might be able to achieve my desired result?
(Edit: it should be noted that these projects are part of a multi project, that’s where the ‘java’ plugin is applied and what not)