Build scripts generated with application plugin, task startScripts produces broken scripts


(Justin Rogers) #1

Gradle 1.7, 1.8

I’m using the ‘application’ plugin. When I run the ‘startScripts’ task and run the generated scripts, I get the following error:

$ build/scripts/myJar.jar
Error: Could not find or load main class my.main.class.Main

This suggests a classpath error. Looking deeper into the generated script, I see this line:

CLASSPATH=$APP_HOME/lib/myJar.jar

However, the path Gradle generates is actually ‘build/libs/myJar.jar’, ‘libs’ with an ‘s’. When I edit the script to say ‘libs’, the script works as expected.

Is this a bug in the plugin or am I doing something wrong?


(Peter Niederwieser) #2

You need to create an application distribution with the ‘installApp’ or ‘distZip’ task, both of which will include the correct start scripts.