Hi,
I have tried the solutions from Stackoverflow and other Gradle forum post but couldn’t make it work out. My problem is as follows:
Project
–Module: dev (depends on prod)
–Module: prod
However, “dev” contains some duplicate class which should be loaded instead of those from “prod” module. ie,
prod: a.java, b.java…
dev: a.java, c.java…
I want my “dev” compile classpath replace “a.java(a.class)” from “prod”. I tried and was thinking of following solutions:
In “dev”'s build.gradle file:
-
compile(project(’:production’)){
exclude “not sure what to do here”
} -
def excludedFiles = configurations.compile.resolvedConfiguration.resolvedArtifacts.findAll {
def moduleId = it.moduleVersion.id
//could it be done this way?
}
// Remove the files from the classpath
sourceSets {
main {
compileClasspath -= files(excludedFiles)
}
}
3.
compile(project(’:prod’, {
sourceSets {
main {
java
{
exclude ‘**/a.java’
}
}
}
}
)) //doesn’t work either
Hope my write up is clear enough for any solutions. I appreciate your time to read this.