gradle-one-jar icon indicating copy to clipboard operation
gradle-one-jar copied to clipboard

Gradle 2.4 support

Open youribonnaffe opened this issue 9 years ago • 3 comments

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)

youribonnaffe avatar May 06 '15 08:05 youribonnaffe

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

PGossek avatar Jul 01 '15 14:07 PGossek

Thanks! It works for me as well, I just defined the manifest outside the task.

youribonnaffe avatar Jul 01 '15 15:07 youribonnaffe

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.)

Giszmo avatar Jan 24 '16 21:01 Giszmo