Modules aren't being added to the module-path and therefore can't find one another. Release 0.12.0 runs on Java 9 but does it actually have module support? If not, when can we expect a release supporting this?
Modules should be added the module-path for the compile and run configurations.
I'm trying to decouple code in my projects into separate modules.
I'd love to contribute myself but I'm not too familiar with the internals of Gradle.
I'm not familiar with the module behaviour that is expected.
Can you give some examples? This may be more a more relevant issue to be opened against the core Gradle repository if this isn't directly related the the Gradle Kotlin DSL.
Are you having problems with a gradle plugin or with source code in your project?
@JLLeitschuh Say I have 2 modules, one depending on another:
module com.mypackage
{
exports com.mypackage;
}
module com.mypackage.example
{
requires com.mypackage;
}
Currently, there's no way to add module "com.mypackage" as a dependency for module "com.mypackage.example". This is similar to having subprojects where you would require another project via implementation(project(":api")). However in Java 9, modules are explicitly required to be defined on the _module-path_. So this is why I stated that the Kotlin compile and run configurations need to be updated in order to support this. Also as I mentioned here, the experimental module plugin only supports Java and not Kotlin, i.e., _compileKotlin_, etc.
This sounds like it's an issue with the Gradle Kotlin plugin which is maintained by Jetbrains here, or its is a problem with the experimental module plugin in which case you should open an issue against the Gradle repository and not the Gradle Kotlin DSL.
@JLLeitschuh Technically there's no bug but rather a missing feature. Basically I'm requesting support for Java 9 modules using Kotlin DSL. I'll mention this once again, the _compileKotlin_ and _run_ configurations don't add modules to the module-path.
Do you have an example of how you can do what you want using the Groovy DSL where the Kotlin DSL is lacking this support?
@PavanChohan This looks like an issue for gradle/gradle, not the Kotlin DSL itself. Gradle does not yet have first-class Java 9 modules support, but you can configure the module-path etc. by following this guide.
@PavanChohan To clarify, one should be able to translate the Groovy examples provided in the aforementioned guide to Kotlin and it should work. Perhaps you are advocating for a Kotlin DSL sample equivalent.
@eriwen If that's the case, a Kotlin project with modules using Kotlin DSL sample would very much appreciated.
@PavanChohan Noted. Such a thing would make a nice community contribution since I don't anticipate great complexity translating the Groovy to Kotlin.
Java 9 modules support is to be implemented in Gradle proper, for languages supported by Gradle built-in plugins. Java 9 modules implemented in Kotlin will then need support in the JetBrains Kotlin Gradle Plugin. All this should be done in a way that works for both the Groovy and Kotlin DSLs, and there shouldn't be anything special to do in the Kotlin DSL itself in this regard.
I'm going to close this.
@PavanChohan, feel free to look for existing or open new issues on gradle/gradle, JetBrains/kotlin and/or gradle-guides/building-java-9-modules.