Gralde-Configuration for java installer

Hi there

I’m currently developing a full java rich client application with an installer. Here’s the project structure:

  • Server
    • Config.xml
  • Installer

When I build and create a jar for the server application (with gradle) then they start and run normally. But here’s the thing: I wan’t to create an installer (a runnable jar) so the user can configure some settings and then the server should be installed (the individual jar should be copied) on the computer by the installer. I only need the server jar file for the execution of the actual project and the installer should create the Config.xml in the install directory (with the server).

So the installation folder should look like this:

  • Installation folder
    • Server.jar
    • Config.xml

How can I create an single Installer.jar with gradle, so the user can download that jar file and execute the installation?

Kind regards
Marc

Maybe you could try izpack.
There is also a Gradle plugin available:
https://plugins.gradle.org/plugin/com.bmuschko.izpack

Thanks @pskiwi

But I kind of want to specify everything by myself. So I’m not looking for an additional plugin… Any ideas on how to do it manually?

Kind regards
Marc

I finally got the solution. I had to add the highlithed code to my generateJar task:

task generateJar(type: Jar) {
	manifest {
		attributes 'Main-Class': 'ch.someMainClass',
				   'Implementation-Title': 'Installation',
				   'Implementation-Version': version
    }
	baseName = project.name
	from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
	exclude('**/*.SF')
	exclude('**/*.RSA')
	exclude('**/*.DSA')
	with jar

from(file("…/[Path_to_Jar]/Server.jar")) { into “ch/distination/path/server” }

}

Hope I can help someone with this comment :smile: