java9-modularity / gradle-modules-plugin

This Gradle plugin helps working with the Java Platform Module System
https://javamodularity.com/
MIT License
230 stars 36 forks source link

Allow patchModule() by group and artifact id #218

Open Flowdalic opened 1 year ago

Flowdalic commented 1 year ago

Assume a JPMS build which depends on Scala 3.

dependencies {
    …
    implementation 'org.scala-lang:scala3-library_3:3.2.1'
}

Such a build needs to patch the org.scala.lang.scala3.library module, provided by scala3-library, because the module exports classes in the scala package and depends on scala-library, which also contains classes in the scala package. So right now I have to

modularity.patchModule("org.scala.lang.scala3.library", "scala-library-2.13.10.jar")

to avoid errors like "error: module scala.library reads package scala from both org.scala.lang.scala3.library and scala.library". However, it would be much user friendly, if the second parameter of patchModule(), could be provided as POM coordinate containing the group id and artifact id (":"), and not the version. For example

modularity.patchModule("org.scala.lang.scala3.library", "org.scala-lang:scala-library")

thus avoiding having to specify a concrete version, which may changes once I bump the version of scala3-library.

big-andy-coates commented 4 months ago

Sounds like a good idea. Please feel free to raise a PR for review.