-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Greetings.
Unfortunately I am facing a challenge when using your Gradle Plugin together with the ShadowJar plugin.
Please see https://github.com/manticore-projects/xml-doclet and especially https://github.com/manticore-projects/xml-doclet/blob/3bf909031b13540f0cfea26a61395ea56d5d006a/build.gradle#L221
ShadowJar will expect 2 zip files to be created:
- build/classes/java/xsd2java
- build/resources/xsd2java
Without those 2 files, it will throw an error message:
Execution failed for task ':shadowJar'.
> Cannot expand ZIP '/home/are/Documents/src/xml-doclet/build/classes/java/xsd2java' as it does not exist.
I do believe, that your Plugin somehow adds those 2 files to the SourceSet or Layout. But I did not see any way to exclude or suppress it.
The only extremely ugly mitigation I found was to create those 2 Zip files:
task createEmptyZip(type: Zip) {
dependsOn(compileJava)
destinationDirectory = file('build/classes/java')
archiveFileName = 'xsd2java'
// Use 'from' to add files to the zip
from files('build/classes/java/main/com/manticore/tools/xmldoclet/xjc') {
include '**/*' // Includes all files in the directory
}
}
task createEmptyZip1(type: Zip) {
dependsOn(processResources)
destinationDirectory = file('build/resources')
archiveFileName = 'xsd2java'
from files('build/resources/main/xjc') {
include '**/*' // Includes all files in the directory
}
}
shadowJar {
dependsOn(createEmptyZip)
dependsOn(createEmptyZip1)
// create the expected ZIP files since we did not find a way to suppress those
archiveBaseName = 'xml-doclet'
}This works but completely messes up the task dependencies and also it pollutes the ShadowJar.
Can you please shed some light on why those two files are added and how to mitigate/solve this challenge better?
Thank you so much already!