简体   繁体   中英

Portable App with Maven launch4j and NSIS

I would like to be able to use Maven to automatize the building process of my application.

The application is a runnable jar that is wrapped with a local copy of a jre using launch4j, which is then included in a NSIS script I have to build an installer.

I found a launch4j plugin for Maven that makes me able to wrap a jar with a local jre like I want to, but the thing is that I'd like to download the proper jre in a local directory when running the Maven build process.

The reason is that for compatibility reasons, the application will be using the jre 1.6 but that could change in the future. Is there a way to make Maven download the jre corresponding to the application setting like it would download a dependency ? Like if I change the configuration to use the 1.8 jre, Maven would download automatically the jre 1.8 in the directory I want.

Is this something possible to do or do I have to download it manually and add the jre directory to my project (or something else that I didn't think of) ?

I found a launch4j plugin for Maven that makes me able to wrap a jar with a local jre like I want to

How did you achieve this, since launch4j doesn't wrap the jre, nor bundle/embed? It only lets you specify a

<path>relative_jre_path_to_your_jar<path>

to a jre. You need to zip your *.exe(which results from launch4j execution) with the jre, and distribute it.

Regarding the controlling of jre versions, you can deploy jre artefacts(different versions) to your maven repository and use the dependency mechanism.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM