pjungwir / launch4j-maven-plugin Goto Github PK
View Code? Open in Web Editor NEWA Maven Plugin for Launch4j
Home Page: http://illuminatedcomputing.com/code/launch4j-maven-plugin/
License: Other
A Maven Plugin for Launch4j
Home Page: http://illuminatedcomputing.com/code/launch4j-maven-plugin/
License: Other
Maven Launch4j Plugin 1.3 A plugin for using Launch4j in Maven projects. Copyright (c) 2006 Paul Jungwirth 16 October 2006 Launch4j by Grzegorz Kowal (http://launch4j.sourceforge.net/) wraps a jar file in a Windows executable to ease deployment of Java desktop applications. You can either bundle a JRE or tell Launch4j to search the hard drive for an existing one. If none is found, then Launch4j will show the user a download page. Launch4j has many features. You can create either GUI or console applications. You can show a splash screen while the JRE loads, give your application a custom icon in the Windows task bar, set a more descriptive process name (other than "java"), and set a variety of other process attributes. You can run Launch4j on Windows, Linux, Solaris, or OS X. You specify the configuration through an XML file. Please see the Launch4j site for more information on this file. You can also set your configuration via the Launch4j GUI. The Maven plugin for Launch4j lets you generate the Launch4j executable as part of the Maven build process. It supports Maven 2.0.4 and Launch4j 3.0.1. You don't have to download Launch4j; all the necessary files are included in the plugin. (The plugin does not include Launch4j's GUI option.) Depending on your operating system, the plugin will download an additional artifact containing platform-specific binaries that Launch4j uses to create the executable. This artifact is treated like any other Maven dependency, so it is only downloaded the first time you need it. Using the Maven plugin, you specify the Launch4j configuration in your POM. I hope to add support for external configuration files, but right now you have to use the POM. The format of this configuration is very similar to the standard Launch4j XML format. There are two main differences. First, any lists of like-named elements must appear in a wrapper element. For example, you can't say: <icon>logo.bin</icon> <var>this=that</var> <var>foo=bar</var> <var>blep=blurp</var> You must say: <icon>logo.bin</icon> <vars> <var>this=that</var> <var>foo=bar</var> <var>blep=blurp</var> </vars> Likewise for <lib> and <obj> elements. Second, the sub-elements of the <classPath> element are a little different. This is so you can set the classpath based on your depedencies. <classPath> still takes a <mainClass> element, but it does not take <cp>. Instead, it supports these children: <addDependencies> If you set this to "true," the plugin will build your classpath based on all dependencies in the runtime and compile scopes. This is on by default. <jarLocation> If you are using the addDependencies feature, you can use this option to add a prefix before each jar's name. This is useful if you are bundling your app with the executable alongside a lib directory that contains all your jars. If that's what you're doing, you would specify <jarLocation>lib/</jarLocation>. <preCp> Use this to add classpath entries before the automatically- generated list. This element functions whether you have enabled <addDependencies> or not. Entries in the list should be separated by semicolons, as in a Windows-style CLASSPATH variable. <postCp> Use this to add classpath entries after the automatically- generated list. This element functions whether you have enabled <addDependencies> or not. Entries in the list should be separated by semicolons, as in a Windows-style CLASSPATH variable. Other than these changes, the XML format is just like Launch4j's standard format. By default, the Launch4j plugin is bound to the package phase. Suppose you have a single-module project named encc. It is a console application, not a GUI. It is packaged as a jar, so the jarring runs automatically during the package phase before anything else. You want to use launch4j to create an executable and then use the assmebly plugin to bundle everything up. You could bind both launch4j and assembly to the package phase with a POM like this: <project> . . . <groupId>com.akathist.encc</groupId> <artifactId>encc</artifactId> <packaging>jar</packaging> . . . <build> <plugins> <plugin> <groupId>com.akathist.maven.plugins.launch4j</groupId> <artifactId>launch4j-maven-plugin</artifactId> <executions> <execution> <id>l4j-clui</id> <phase>package</phase> <goals><goal>launch4j</goal></goals> <configuration> <headerType>console</headerType> <outfile>target/encc.exe</outfile> <jar>target/encc-1.0.jar</jar> <errTitle>encc</errTitle> <classPath> <mainClass>com.akathist.encc.Clui</mainClass> <addDependencies>false</addDependencies> <preCp>anything</preCp> </classPath> <jre> <minVersion>1.5.0</minVersion> </jre> <versionInfo> <fileVersion>1.2.3.4</fileVersion> <txtFileVersion>txt file version?</txtFileVersion> <fileDescription>a description</fileDescription> <copyright>my copyright</copyright> <productVersion>4.3.2.1</productVersion> <txtProductVersion>txt product version</txtProductVersion> <productName>E-N-C-C</productName> <internalName>ccne</internalName> <originalFilename>original.exe</originalFilename> </versionInfo> </configuration> </execution> </executions> </plugin> <plugin> <artifactId>maven-assembly-plugin</artifactId> <executions> <execution> <id>assembly</id> <phase>package</phase> <goals><goal>attached</goal></goals> <configuration> <descriptors> <descriptor>assembly.xml</descriptor> </descriptors> </configuration> </execution> </executions> </plugin> </plugins> </build> . . . </project> Note that when you bind the assembly plugin to a phase, you must use assembly:attached, not assembly:assembly, to prevent its forking a parallel lifecycle and running everything twice. Or suppose your application can run in either GUI or console mode, and you want to create separate executables for each. Then your POM would look like this: <project> . . . <groupId>com.akathist.encc</groupId> <artifactId>encc</artifactId> <packaging>jar</packaging> . . . <build> <plugins> <plugin> <groupId>com.akathist.maven.plugins.launch4j</groupId> <artifactId>launch4j-maven-plugin</artifactId> <executions> <execution> <id>l4j-clui</id> <phase>package</phase> <goals><goal>launch4j</goal></goals> <configuration> <headerType>console</headerType> <outfile>target/encc.exe</outfile> <jar>target/encc-1.0.jar</jar> <errTitle>encc</errTitle> <classPath> <mainClass>com.akathist.encc.Clui</mainClass> <addDependencies>false</addDependencies> <preCp>anything</preCp> </classPath> <jre> <minVersion>1.5.0</minVersion> </jre> <versionInfo> <fileVersion>1.2.3.4</fileVersion> <txtFileVersion>txt file version?</txtFileVersion> <fileDescription>a description</fileDescription> <copyright>my copyright</copyright> <productVersion>4.3.2.1</productVersion> <txtProductVersion>txt product version</txtProductVersion> <productName>E-N-C-C</productName> <internalName>ccne</internalName> <originalFilename>original.exe</originalFilename> </versionInfo> </configuration> </execution> <execution> <id>l4j-gui</id> <phase>package</phase> <goals><goal>launch4j</goal></goals> <configuration> <headerType>gui</headerType> <outfile>target/enccg.exe</outfile> <jar>target/encc-1.0.jar</jar> <errTitle>enccg</errTitle> <classPath> <mainClass>com.akathist.encc.Gui</mainClass> </classPath> <jre> <minVersion>1.5.0</minVersion> </jre> <versionInfo> <fileVersion>1.2.3.4</fileVersion> <txtFileVersion>txt file version?</txtFileVersion> <fileDescription>a description</fileDescription> <copyright>my copyright</copyright> <productVersion>4.3.2.1</productVersion> <txtProductVersion>txt product version</txtProductVersion> <productName>E-N-C-C</productName> <internalName>ccne</internalName> <originalFilename>original.exe</originalFilename> </versionInfo> </configuration> </execution> </executions> </plugin> <plugin> <artifactId>maven-assembly-plugin</artifactId> <executions> <execution> <id>assembly</id> <phase>package</phase> <goals><goal>attached</goal></goals> <configuration> <descriptors> <descriptor>assembly.xml</descriptor> </descriptors> </configuration> </execution> </executions> </plugin> </plugins> </build> . . . </project> If you have any questions, just send me a note.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.