-
Notifications
You must be signed in to change notification settings - Fork 9
Description
Hello
We have very mixed environment where half of the jars are either jpms modules already or are getting transformed into one, and the other half uses the classpath is not compatible with jpms.
I used to deal with that using a configuration like this
val moduleC by configurations.registering {
shouldResolveConsistentlyWith(configurations.runtimeClasspath.get())
isCanBeConsumed = false
attributes{
attribute(OperatingSystemFamily.OPERATING_SYSTEM_ATTRIBUTE, objects.named(OperatingSystemFamily.WINDOWS))
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, project.objects.named(LibraryElements::class, "jar"))
attribute(Attribute.of("javaModule", Boolean::class.javaObjectType),true )
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
}
}
And that way i could let gradle know that everything related configuration needed to be jpms compatible, aka know as if it already had a module-info take the file as it is, otherwise perform necessary transformation.
However the behavior of this plugin changed from 1.10.1 to 1.11 has changed.
05ea60c#diff-76ff4b4e6220621d24b63f06bfd513455e106bbdfa3cbba95f2a78950e9cb2a5
// outgoing variants may express that they already provide a modular Jar and can hence skip the transform altogether
Which will lead to
- Incompatible because this component declares a component, as well as attribute 'javaModule' with value 'false' and the consumer needed a component, as well as attribute 'javaModule' with value 'true'
So my feedback would be that its a bit problematic to simply set skipLocalJars to false by default and add publish this information.
Once you read through the source code ok you realize that ist required to set skipLocalJars to true in every project that already have a module-info but its a bit unintuitive..
Like usually you would use this plugin because your sourcecode has a module-info and thats the reason you are dealing with jpms in the first place, so I would guess in most cases skipLocalJars needs to be true and its really an odd corner case when you are applying this plugin to your project, but your project doesnt have a module-info itself...