Reputation: 1568
Recently I completed one JavaFX project and now I want to create native installer for windows. I'm using exec-maven-plugin
to create an installer and it's working fine and generate exe file with default setting of inno setup script.
I created one inno setup script named [project-name].iss and placed it in app\src\main\deploy\package\windows\[project-name].iss
.
My maven plugin code looks like
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>package-jar</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>
${env.JAVA_HOME}/bin/javapackager
</executable>
<arguments>
<argument>-createjar</argument>
<argument>-appclass</argument>
<argument>${app.main.class}</argument>
<argument>-srcdir</argument>
<argument>
${project.build.directory}/classes
</argument>
<argument>-outdir</argument>
<argument>./target</argument>
<argument>-outfile</argument>
<argument>
${project.artifactId}-app
</argument>
<argument>-v</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>package-jar2</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>
${env.JAVA_HOME}/bin/javapackager
</executable>
<arguments>
<argument>-deploy</argument>
<argument>-native</argument>
<argument>installer</argument>
<argument>-appclass</argument>
<argument>${app.main.class}</argument>
<argument>-srcfiles</argument>
<argument>
${project.build.directory}/${artifactId}-app.jar
</argument>
<argument>-outdir</argument>
<argument>./target</argument>
<argument>-outfile</argument>
<argument>
${project.artifactId}-app
</argument>
<argument>-v</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
And [project-name].iss file looks like
[Setup]
AppName=Project Name
AppId=ProjectName
AppVersion=0.1.0
AppPublisher=Project Name
AppPublisherURL=http://www.todo.com/
AppSupportURL=http://www.todo.com/
AppUpdatesURL=http://www.todo.com/
MinVersion=5.1
DefaultDirName={pf}\Project Name
DefaultGroupName=Project Name
AllowNoIcons=yes
Compression=lzma2/ultra
InternalCompressLevel=ultra
SolidCompression=yes
SetupIconFile=icon.ico
AllowCancelDuringInstall=false
But after maven package I'm getting executable file which doesn't have any properties from above inno setup script.(I also placed icon.ico file in app\src\main\deploy\package\windows\icon.ico
)
Output log while packaging app (It's taking defaults not using [project-name].iss script configuration)
So can you help me any configuration I'm missing in maven plugin or anything else?
Thanks.
Upvotes: 5
Views: 4752
Reputation: 79
You could try JavaPackager Maven Plugin. It doesn't depend on javapackager
tool.
Your POM will only have to contain something like this:
<plugin>
<groupId>io.github.fvarrui</groupId>
<artifactId>javapackager</artifactId>
<version>0.9.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>package</goal>
</goals>
<configuration>
<name>ProjectName</name>
<version>0.1.0</version>
<url>http://www.todo.com/</url>
<mainClass>${app.main.class}</mainClass>
<bundleJre>true</bundleJre>
<iconFile>src/main/deploy/package/windows/icon.ico</iconFile>
</configuration>
</execution>
</executions>
</plugin>
and the plugin will generate an installer for your app with a bundled and customized JRE. It'll do all the work for you, so you don't have to worry about any ISS file.
Upvotes: 2
Reputation: 2858
(even if this is an old question, some others might search for this)
You need to take care of the correct filename, the used appName is responsible for the filename the javapackager is searching for.
As you did not provide some -name
-parameter, the appName is gathered from the provided main-class (appclass
-parameter), this is even printed inside that command-log, that Main.ico
gets used. So you need to add this:
<argument>-name</argument>
<argument>${project.artifactId}</argument>
This means that the filename of the .ico
-file has to be ${project.artifactId}.ico
below that app/src/main/deploy/windows
-folder.
Upvotes: 1