Maven - exe file creation on Windows (launch4j-maven-plugin)

Card Puncher Data Processing

About

With the launch4j-maven-plugin it's possible to package you code in one big exe file.

Example

<plugin>
	<groupId>com.akathist.maven.plugins.launch4j</groupId>
	<artifactId>launch4j-maven-plugin</artifactId>
	<version>1.7.16</version>
	<executions>
		<execution>
			<id>l4j-clui</id>
			<phase>package</phase>
			<goals><goal>launch4j</goal></goals>
			<configuration>
				<headerType>console</headerType>
				<outfile>target/${exeFileName}.exe</outfile>
				<jar>target/${jarFileName}.jar</jar>
				<errTitle>encc</errTitle>
				<classPath>
					<mainClass>myPackage.myMainClass</mainClass>
					<addDependencies>true</addDependencies>
					<preCp>anything</preCp>
				</classPath>
				<jre>
					<minVersion>${version.jre.launch4j}</minVersion>
					<opts>
						<opt>-Djava.endorsed.dirs=./endorsed</opt>
					</opts>
				</jre>
				<versionInfo>
					<fileVersion>${launch4jVersion}</fileVersion>
					<txtFileVersion>${launch4jVersion}</txtFileVersion>
					<fileDescription>${project.name}</fileDescription>
					<copyright>MIT</copyright>
					<productVersion>${launch4jVersion}</productVersion>
					<txtProductVersion>${launch4jVersion}</txtProductVersion>
					<productName>${project.name}</productName>
					<originalFilename>${exeFileName}.exe</originalFilename>
					<!-- internalName is mandatory -->
					<internalName>${exeFileName}</internalName>
				</versionInfo>
			</configuration>
		</execution>
	</executions>
</plugin>
<!-- Just copy the file in the local bin -->
<plugin>
	<artifactId>maven-resources-plugin</artifactId>
	<version>3.0.0</version>
	<executions>
		<execution>
			<id>deploy-to-local-directory</id>
			<phase>install</phase>
			<goals>
				<goal>copy-resources</goal>
			</goals>
			<configuration>
				<outputDirectory>${bin.local.path}</outputDirectory>
				<resources>
					<resource>
						<directory>${project.build.directory}</directory>
						<includes>
							<include>*.exe</include>
						</includes>
						<filtering>false</filtering>
					</resource>
				</resources>
			</configuration>
		</execution>
	</executions>
</plugin>





Discover More
Card Puncher Data Processing
Maven - Package

Packaging in Maven. Package is a phase that bundle the code in a way suitable to be distributed. By default, this phase will take the compiled code and make an archive of it as define in the packaging...
Windows 95 Wallpaper Version
Windows - Installer

installer on Windows. There is two kind of installer: manually downloaded and run (ie executable) or installer manager (sort of package manager but for installation) An installer executable...



Share this page:
Follow us:
Task Runner