Manifest.from(Object...)
does not support merging Manifest implementations
#20928
Labels
Milestone
Manifest.from(Object...)
does not support merging Manifest implementations
#20928
Expected Behavior
One should be able to pass an implementation of
org.gradle.api.java.archives.Manifest
toManifest.from(Object...)
to get the argument manifest merged into the receiver manifest.The javadoc indicates this is supported.
Current Behavior
The current implementation of
DefaultManifestMergeSpec
requires the manifest object to be an instance of the internalDefaultManifest
type:gradle/subprojects/platform-jvm/src/main/java/org/gradle/api/java/archives/internal/DefaultManifestMergeSpec.java
Line 152 in 270f942
rather than the
Manifest
type. When the manifest object is not an instance of the internalDefaultManifest
type, the code attempts to resolve the manifest object as a file path which fails.Context
The is affecting the use of custom manifest object in plugins as they cannot merge a manifest object unless it is of the internal
DefaultManifest
type.Steps to Reproduce
This can be seen when using the latest fix bndtools/bnd#5276 to the Bnd Gradle plugin (6.4.0-SNAPSHOT) when building JUnit 5 which also uses the
com.github.johnrengelman.shadow
plugin. These two plugins interact over the jar task's manifest object. With the Bnd fix, the following exception occurs.I have a PR I will submit with the fix for this issue.
Your Environment
Build scan URL:
https://scans.gradle.com/s/huhyrwmnaz73w
The text was updated successfully, but these errors were encountered: