javafx-gradle-plugin: JfxJar-task producing stackoverflow

In my project i need swt. So i add it in gradle. The problem with swt dependency. swt depend on native libs. native libs depends on swt. Build task is work correct, but JafJar is failed with stakOverflow. This gradle script is work. If comment work region and uncomment not work in dependencies, you will be get error.

buildscript {
    dependencies {
        classpath group: 'de.dynamicfiles.projects.gradle.plugins', name: 'javafx-gradle-plugin', version: '8.8.2'
    }
    repositories {
        mavenLocal()
        mavenCentral()
    }
    ext {
        osgi_platform = 'win32.win32.x86_64'
        swt_version = '3.105.3'
    }
}
plugins {
    id "net.ltgt.apt" version "0.10"
}

apply plugin: 'java'
apply plugin: 'idea'

repositories {
    mavenCentral()
}

configurations.all {
    resolutionStrategy {
        dependencySubstitution {
            // The maven property ${osgi.platform} is not handled by Gradle
            // so we replace the dependency, using the osgi platform from the project settings
            substitute module('org.eclipse.platform:org.eclipse.swt.${osgi.platform}') with module("org.eclipse.platform:org.eclipse.swt.$osgi_platform:$swt_version")
        }
    }
}

dependencies {
    apt 'com.google.dagger:dagger-compiler:2.10'
    compile 'com.google.dagger:dagger:2.10'
    compile 'net.coobird:thumbnailator:0.4.8'
    compile 'commons-io:commons-io:2.5'
    compile ('org.eclipse.platform:org.eclipse.jface:3.12.2'){
        exclude module: 'org.eclipse.swt'
    }
    //work
    compile ("org.eclipse.platform:org.eclipse.swt:$swt_version"){
        transitive = false
    }
    compile ("org.eclipse.platform:org.eclipse.swt.$osgi_platform:$swt_version"){
        transitive = false
    }

    //not work
    // compile ("org.eclipse.platform:org.eclipse.swt:$swt_version")


    compile 'com.google.guava:guava:22.0'
    compile fileTree(dir: 'libs', include: '*.jar')
}


apply plugin: 'javafx-gradle-plugin'

jfx {
    // minimal requirement for jfxJar-task
    mainClass = 'app.App'

    // minimal requirement for jfxNative-task
    vendor = 'YourName'
} ```

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

Hmm, so I stripped out and reduce my project to a single project structure (no sub projects) so now it’s just the MapTool as a single project. I also stripped and reduced the gradle build to a more bare bones setup.

I then removed what I thought may be the more complicated lib dependencies, org.bouncycastle, libgdx, and nashorn api. I still get the stackoverflow error 😦

So not sure what the issue is… BTW, I’m able to package just fine use javapackager as a JavaExec task…

Here’s my current gradle build:

/*
 * For more details take a look at the Java Quickstart chapter in the Gradle
 * user guide available at https://docs.gradle.org/4.1/userguide/tutorial_java_projects.html
 */
 
//import org.apache.tools.ant.filters.ReplaceTokens
//import java.text.SimpleDateFormat
//import org.ajoberstar.grgit.*
//import org.gradle.api.tasks.JavaExec

buildscript {
    dependencies {
        classpath group: 'de.dynamicfiles.projects.gradle.plugins', name: 'javafx-gradle-plugin', version: '8.8.2'
    }
    
    repositories {
        mavenCentral()
    }
}

// Apply the java plugin to add support for Java
apply plugin: 'base'
apply plugin: 'application'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'javafx-gradle-plugin'

// Definitions
defaultTasks 'clean', 'run'
sourceCompatibility = 1.8
targetCompatibility = 1.8

// Used by gradle assemble & run tasks
version = '1.4.4.0'
mainClassName = 'net.rptools.maptool.client.LaunchInstructions'
applicationDefaultJvmArgs = ["-Xss4M"]

// Custom properties
ext {
    gdxVersion = '1.9.6'
    box2DLightsVersion = '1.4'
    //aiVersion = '1.8.0'
    //roboVMVersion = '2.3.0'
}


run {
	println 'Default arguments being passed...'
	args = [ '-v='+version, '-debug', '-fullscreen' ]
}


jfx {
    // minimal requirement for jfxJar-task
    mainClass = mainClassName
    
    // minimal requirement for jfxNative-task
    vendor = 'Nerps'
}


// In this section you declare where to find the dependencies of your project
repositories {
    // Use 'jcenter' for resolving your dependencies.
    // You can declare any Maven/Ivy/file repository here.
    jcenter()
    mavenCentral()
    maven { url = 'http://maptool.craigs-stuff.net/repo/' }
	maven { url = 'http://www.nerps.net/repo/' }
	mavenLocal()
}


// In this section you declare the dependencies for your production and test code
dependencies {
 	compile files("${System.properties['java.home']}/../lib/packager.jar")	// This dependency is for UserJvmOptionsService
 	
	compile 'net.java.abeille:abeille-formsrt:2.0'
	compile 'net.rptools.clientserver:clientserver:1.4.0.+'
	compile 'org.hibernate:antlr:2.7.5H3'
	compile 'commons-beanutils:commons-beanutils-core:1.8.3'
	compile 'org.ow2.util.bundles:commons-collections-3.2.1:1.0.0'
	compile 'commons-io:commons-io:2.4'
	compile 'commons-jxpath:commons-jxpath:1.3'
	compile 'commons-lang:commons-lang:2.6'
	compile 'commons-logging:commons-logging:1.1.1'
	compile 'commons-net:commons-net:3.2'
	compile 'commons-cli:commons-cli:1.3'
	compile 'net.rptools.decktool:decktool:1.0.b1'
	compile 'net.rptools.dicelib:dicelib:1.4.0.+'
	compile 'net.sf.ezmorph:ezmorph:1.0.5'
	compile 'com.caucho.hessian:hessian:3.1.6'
	compile 'jide-common:jide-common:3.2.3'
	compile 'jide-components:jide-components:3.2.3'
	compile 'jide-dialogs:jide-dialogs:3.2.3'
	compile 'jide-dock:jide-dock:3.2.3'
	compile 'jide-editor:jide-editor:3.2.3'
	compile 'jide-grids:jide-grids:3.2.3'
	compile 'jide-properties:jide-properties:3.2.3'
	compile 'jide-shortcut:jide-shortcut:3.2.3'
	compile 'de.huxhorn.sulky:de.huxhorn.sulky.3rdparty.jlayer:1.0'
//	compile 'rhino:js:1.7R1'
	compile 'net.sf.json-lib:json-lib:2.4:jdk15'
	compile 'log4j:log4j:1.2.16'
	compile 'net.rptools.maptool.resource:maptool.resource:1.0.b18'
	compile 'net.rptools.parser:parser:1.4.0.+'
	compile 'ca.odell.renderpack:renderpack:1.2004'
	compile 'net.tsc.servicediscovery:servicediscovery:1.0.b5'
	compile 'org.swinglabs:swing-worker:1.1'
	compile 'net.sbbi.upnp:upnplib:1.0.9-nodebug'
	compile 'com.withay:withay-util:1.0'
	compile 'xmlpull:xmlpull:1.1.3.1'
	compile 'xpp3:xpp3_min:1.1.4c'
	compile 'com.thoughtworks.xstream:xstream:1.4.9'
	compile 'yasb:yasb:0.2-21012007'
	compile 'de.muntjak.tinylookandfeel:tinylaf-nocp:1.4.0'
	compile 'org.eclipse.jetty:jetty-server:9.3.0.M0'
	compile 'org.eclipse.jetty:jetty-servlet:9.3.0.M0'
	compile 'org.eclipse.jetty:jetty-webapp:9.3.0.M0'
	compile 'org.eclipse.jetty:jetty-continuation:9.3.0.M1'
	compile 'org.eclipse.jetty.websocket:websocket-server:9.3.0.M1'
	compile 'org.eclipse.jetty.websocket:websocket-client:9.3.0.M1'
	compile 'org.eclipse.jetty.websocket:websocket-servlet:9.3.0.M1'
	compile 'org.eclipse.jetty.websocket:websocket-api:9.3.0.M1'
	compile 'org.reflections:reflections:0.9.10'
	compile 'org.apache.pdfbox:pdfbox:2.0.0'									// Jamz: For pdf image extraction
	compile 'org.apache.pdfbox:pdfbox-tools:2.0.0'								// Jamz: Dependancy for pdfbox
//	compile 'org.bouncycastle:bcmail-jdk15on:1.54'								// Jamz: To decrypt passworded/secured pdf's
	compile 'com.github.jai-imageio:jai-imageio-core:1.3.1'						// Jamz: For pdf image extraction, specifically for jpeg2000 (jpx) support.
	compile 'com.github.jai-imageio:jai-imageio-jpeg2000:1.3.0'					// Jamz: For pdf image extraction, specifically for jpeg2000 (jpx) support.
	compile group: 'com.fifesoft', name: 'rsyntaxtextarea', version: '2.6.0'	// https://mvnrepository.com/artifact/com.fifesoft/rsyntaxtextarea
	compile group: 'com.fifesoft', name: 'autocomplete', version: '2.6.0'		// https://mvnrepository.com/artifact/com.fifesoft/autocomplete
	compile group: 'com.fifesoft', name: 'rstaui', version: '2.6.0'				// https://mvnrepository.com/artifact/com.fifesoft/rstaui
	compile group: 'com.jcabi', name: 'jcabi-xml', version: '0.18.1'			// https://mvnrepository.com/artifact/com.jcabi/jcabi-xml
	
	// box2dlights test
	//compile group: 'com.badlogicgames.gdx', name: 'gdx-platform', version: '1.9.5'			// https://mvnrepository.com/artifact/com.badlogicgames.gdx/gdx-platform
	//compile group: 'com.badlogicgames.gdx', name: 'gdx-backend-lwjgl', version: '1.9.5'		// https://mvnrepository.com/artifact/com.badlogicgames.gdx/gdx-backend-lwjgl
	//compile group: 'com.badlogicgames.gdx', name: 'gdx-box2d', version: '1.9.5'				// https://mvnrepository.com/artifact/com.badlogicgames.gdx/gdx-box2d
	//compile group: 'com.badlogicgames.box2dlights', name: 'box2dlights', version: '1.4'

//	compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
//	compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
//	compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
    
//	compile "com.badlogicgames.gdx:gdx:$gdxVersion"
//	compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
//	compile "com.badlogicgames.box2dlights:box2dlights:$box2DLightsVersion"
    
    // Not in use at this time, left for easy reference later...
    //compile "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"
    //compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
    //compile "com.badlogicgames.ashley:ashley:$ashleyVersion"
    //compile "com.badlogicgames.gdx:gdx-ai:$aiVersion"
    //compile "com.badlogicgames.gdx:gdx-bullet:$gdxVersion"
    
    // Declare the dependency for your favourite test framework you want to use in your tests.
    // TestNG is also supported by the Gradle Test task. Just change the
    // testCompile dependency to testCompile 'org.testng:testng:6.8.1' and add
    // 'test.useTestNG()' to your build script.
    testCompile 'junit:junit:4.12'
}

// Adjust access rule in Eclipse for Nashorn
eclipse.classpath.file {
		whenMerged {
			withXml { classpathXml ->
				def classpathXmlNode = classpathXml.asNode()
				Node classpathJreNode = node.find {
					it.@kind == 'con' &&
					it.@path.contains('JRE_CONTAINER') &&
					it.@path.contains('JavaSE-1.8')
				}
				// Only append if node is not null, eg
				// if it found the proper node entry.
				if (classpathJreNode) {
					classpathJreNode
						.appendNode('accessrules')
						.appendNode('accessrule', [
							kind: 'accessible',
							pattern: 'jdk/nashorn/api/**'
						])
				}
			}
		}
	}