gradle-one-jar
gradle-one-jar copied to clipboard
Gradle 2.4 support
Hi,
When trying to use the plugin with Gradle 2.4, I'm facing two issues:
- https://discuss.gradle.org/t/output-files-resolution-with-2-4/9495/1
- StackOverflowError when setting a custom manifest (see here for a test https://github.com/youribonnaffe/gradle-one-jar-2.4/tree/manifest, gradle oneJar)
Caused by: java.lang.StackOverflowError at org.gradle.api.tasks.bundling.Jar.manifest(Jar.groovy:29) at com.github.rholder.gradle.task.OneJar.super$8$manifest(OneJar.groovy) at org.gradle.api.tasks.bundling.Jar.manifest(Jar.groovy:29) at com.github.rholder.gradle.task.OneJar.super$8$manifest(OneJar.groovy)
Unfortunately for now, I haven't find what could be the problem for both (could it be related to the fact that the Jar class changed from Groovy to Java? for the second issue)
Hi, I resolved this problem with moving manifest to external block:
ext.sharedManifest = manifest { attributes 'One-Jar-URL-Factory': 'com.simontuffs.onejar.JarClassLoader$OneJarURLFactory' }
task myJar(type: OneJar) { [...] manifest = project.manifest { from sharedManifest } [...] }
My inspiration was chapter 22.14. Jar from: https://docs.gradle.org/current/userguide/java_plugin.html
Thanks! It works for me as well, I just defined the manifest outside the task.
I'm new to the issue and this solution that worked for others, doesn't seam to work here. As suggested by a colleague, I'm looking into ShadowJar now.
(Bumping the issue as it's not resolved and didn't get much attention it seams.)