matthieun
matthieun

Reputation: 833

Gradle and Java 11: Partial module path

I want to modularize my Gradle project with Java 11. Unfortunately, many of my dependencies are not modular yet. As a consequence, my module-info.java contains a lot of automatic modules, derived from the dependency names. Also, I followed this Gradle tutorial and added this to my build.gradle:

compileJava {
    inputs.property("moduleName", moduleName)
    doFirst {
        options.compilerArgs = [
            '--module-path', classpath.asPath,
        ]
        classpath = files()
    }
}

The big problem here is that many dependencies contain the same package names, which triggers the build to fail on numerous instances of type:

error: module MMMM.MMMM reads package PPPP.PPPP from both AAAA.AAAA and BBBB.BBBB

What I would like to do is tell Gradle to add the modularized dependencies to the modulepath, and keep the conflicting ones in the classpath. Is that something possible, and how?

Upvotes: 3

Views: 783

Answers (0)

Related Questions