I am trying to integrate the generation of an installer as part of a maven compilation process.
I have found Alakai's plugin for Launch4j. I have create a simple Hello World application using Maven. I have tried to use configuration examples provided by Alakai, but when I compile my project, I get:
Failed to execute goal org.bluestemsoftware.open.maven.plugin:launch4j-plugin:1.5.0.0:launch4j (launch4j) on project Launch4j: Failed to build the executable; please verify your configuration. Application jar doesnt exist. -> [Help 1]
Unfortunately, Alakai's documentation is limited and I could not find much with Googling.
Thanks.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached> <!-- Make the shaded artifact not the main one -->
<shadedClassifierName>shaded</shadedClassifierName> <!-- set the suffix to the shaded jar -->
</configuration>
</plugin>
<plugin>
<groupId>org.bluestemsoftware.open.maven.plugin</groupId>
<artifactId>launch4j-plugin</artifactId>
<version>1.5.0.0</version>
<executions>
<!-- GUI exe -->
<execution>
<id>l4j-gui</id>
<phase>package</phase>
<goals>
<goal>launch4j</goal>
</goals>
<configuration>
<headerType>gui</headerType>
<outfile>target/app-gui.exe</outfile>
<jar>target/${artifactId}-${version}-shaded.jar</jar> <!-- 'shaded' is the value set on shadedClassifierName above -->
<errTitle>App Err</errTitle>
<classPath>
<mainClass>package.AppGUI</mainClass>
</classPath>
<icon>src/main/resources/icons/exeIcon.ico</icon>
<jre>
<minVersion>1.5.0</minVersion>
<maxVersion>1.6.0</maxVersion>
<initialHeapSize>128</initialHeapSize>
<maxHeapSize>1024</maxHeapSize>
</jre>
<versionInfo>
<fileVersion>1.0.0.0</fileVersion>
<txtFileVersion>1.0.0.0</txtFileVersion>
<fileDescription>Desc</fileDescription>
<copyright>C</copyright>
<productVersion>1.0.0.0</productVersion>
<txtProductVersion>1.0.0.0</txtProductVersion>
<productName>Product</productName>
<internalName>Product</internalName>
<originalFilename>App.exe</originalFilename>
</versionInfo>
</configuration>
</execution>
<!-- Command-line exe -->
<execution>
<id>l4j-cli</id>
<phase>package</phase>
<goals>
<goal>launch4j</goal>
</goals>
<configuration>
<headerType>console</headerType>
<outfile>target/app-cli.exe</outfile>
<jar>target/${artifactId}-${version}-shaded.jar</jar> <!-- 'shaded' is the value set on shadedClassifierName above -->
<errTitle>App Err</errTitle>
<classPath>
<mainClass>package.AppCLI</mainClass>
</classPath>
<icon>src/main/resources/icons/exeIcon.ico</icon>
<jre>
<minVersion>1.5.0</minVersion>
<maxVersion>1.6.0</maxVersion>
<initialHeapSize>128</initialHeapSize>
<maxHeapSize>1024</maxHeapSize>
</jre>
</configuration>
</execution>
</executions>
</plugin>
Alternatively, You can omit the 'jar' tag on launch4j-plugin and remove the extra configs of the shade-plugin, but be aware that this will replace the main jar of the flow (without embedded dependencies) by the shaded jar (with embedded dependencies), and this one will be installed on your local repo, or used in the reactor if needed.