Hi,
We’ve recently upgraded from Gradle 1.5 to Gradle 1.8 (running with the Gradle wrapper) and we are getting a java.lang.NoClassDefFoundError as below when running a “clean build”. This only seems to happen on our Solaris build server, we don’t get this on our Windows PC’s.
FAILURE: Build failed with an exception.
* Where:
Build file '/uwm/uwm-ci/jobs/bpm-master-build/workspace/appletgenerator/build.gradle' line: 262
* What went wrong:
Execution failed for task ':appletgenerator:war'.
> java.lang.NoClassDefFoundError: build_6a2mtl1h45b3e68kqu5ktctfvj$_run_closure11_closure44_closure45
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Line 262 in our build file is the line 'configurations.warClient.collect below. The code section below is in a WAR task, we use the configuration to update a JNLP file (using a filter) with the list of JAR files from that configuration. This always worked ok on Gradle 1.5, but since upgrading to 1.8 we get the NoClassDefFoundError when running the build on Solaris.
NOTE: the code I’ve pasted below is getting a bit garbled (sections are being duplicated) - is there a way I can attach the file to the forum?
doFirst {
//update token in applet jnlp file with list of all client JAR's.
This is in a
//doFirst section so its run in Gradle's execution phase.
If this is done without the doFirst
//not all of the dependencies are resolved
def jarList = configurations.warClient.collect { File file ->
def mainJar = file.name.startsWith('ois-swingClient')
//set download of main jar as eager, downloadType will default to lazy for the other JAR's
//unless a system property 'download' is specified e.g. -Ddownload=eager
def downloadType = mainJar ? "eager" : "<%=downloadType%>"
"<jar href=\"${file.name}\" main=\"${mainJar}\" download=\"${downloadType}\" />"
}
//create a list of client JAR's and put the main JAR ois-swingClient at the top of the list
def sortedJarList = jarList.sort{!it.contains("ois-swingClient")}.join(System.getProperty("line.separator"))
from ('skeleton') {
filesMatching("**/*.jsp") {
filter(ReplaceTokens, tokens: [
'security-all-permission': securitySetting,
'packed_jars': packToken,
'Supported-Resource': supportedResource,
'Supported-Java': supportedJava,
'client_jars': sortedJarList])
}
filesMatching("**/timestamp.html") {
filter(ReplaceTokens, tokens: [
'Jar_Version': version,
'Internal-Release': releaseTag,
'Unspecified': buildTimestamp])
}
into ('/')
}
//include the clientInstallers generated by jwrapper (NOTE: we only include the JRE from one of the00023310637
//build directories and we don't include any of the generated builds for Linux or Mac)
FileTree jwrapperFileTree = fileTree("${project(':bpmClientInstaller').projectDir}/build/jwrapper") {
include "**/Live/build/JWrapper-Windows32JRE*"
include "**/Live/build/JWrapper-JWrapper*"
include "**/build/*.jar"
include "**/build/Orchard*-windows32-online.exe"
include "**/build/JWrapper-Orchard*"
exclude "**/build/*Linux*"
exclude "**/build/*Mac*"
exclude "**/build/JWrapper-Windows64JRE*"
}
//using a fileTree so we can flatten the directories of the copied files
from (jwrapperFileTree.files) {
into "clientInstall"
}
}
}
The only change to the build.gradle script between the releases was the use of the filesMatching method (the Pattern based file copy configuration documented in the 1.7 release notes – and this is below the line failing with the NoClassDefFoundError).
Thanks,
Richard.