I am trying to use IZPack with a Gradle build. We have been using v4.3.5 but are now moving to v5.0.6.
In v4.3.5 we could use a the gradle izpack plugin to perform the compilation of the installer but v5.0.6 I need to get Gradle to invoke the Ant Task : com.izforge.izpack.ant.IzPackTask
I have the following Gradle task defined to invoke izPack via Ant:
task izPack {
ant.taskdef(name: 'izPack', classname: 'com.izforge.izpack.ant.IzPackTask',
classpath: configurations.izpack.asPath)
ant.properties.applicationVersion = '0.9.1'
ant.properties.izPackConfigDirectory = projectDir.path + '/src/main/izpack'
ant.properties.installerArtifactsDirectory = buildDir.path + '/installerArtifacts'
ant.properties.installerTasksJar = buildDir.path + "/libs/mesh-installer.jar"
ant.izPack(input:projectDir.path + '/src/main/izpack/install.xml',
output:buildDir.path + '/distributions/mesh-${meshVersion}-installer.jar',
installerType:'standard',
basedir:projectDir.path + '/src/main/izpack',
inheritAll:true)
}
This mostly works but I am having problems injecting parameters into this Ant Task so that the can be substituted in the installer.xml.
ant.properties.applicationVersion = ‘0.9.1’
ant.properties.izPackConfigDirectory = projectDir.path + '/src/main/izpack'
ant.properties.installerArtifactsDirectory = buildDir.path + '/installerArtifacts'
ant.properties.installerTasksJar = buildDir.path + "/libs/mesh-installer.jar"
If I set the inheritAll flag to true on the izPackTask then I get the following error:
[ant:izPack] Exception in thread "Thread-3" java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
[ant:izPack] at com.izforge.izpack.ant.IzpackAntRunnable.run(IzpackAntRunnable.java:67)
[ant:izPack] at java.lang.Thread.run(Thread.java:745)
It looks like Gradle is setting 1 or more project properties to be an Integer rather than a String and this is causing the issue within the IzpackantRunnableTask as it casts an Object to String without checking if this can be performed. Is there a way to explicitly declare properties on the izPackTask rather than inheriting all of the properties from the project?
Thanks