fvarrui / JavaPackager

:package: Gradle/Maven plugin to package Java applications as native Windows, MacOS, or Linux executables and create installers for them.
GNU General Public License v3.0
1.07k stars 134 forks source link

Failed to package exe #347

Closed minliuhua closed 1 year ago

minliuhua commented 1 year ago

I'm submitting a…

Short description of the issue/suggestion: Error reported after packaging into exe using mvn package

Steps to reproduce the issue/enhancement: The pom.xml configuration is as follows, and Inno Setup6.2.2 and wix311 are installed

 <plugin>
                <groupId>io.github.fvarrui</groupId>
                <artifactId>javapackager</artifactId>
                <version>1.7.2</version>
                <configuration>
                    <name>fx-project</name>
                    <bundleJre>true</bundleJre>
                    <mainClass>com.example.demo.StartUp</mainClass>
                    <generateInstaller>true</generateInstaller>
                </configuration>
                <executions>
                    <execution>
                        <id>bundling-for-windows</id>
                        <phase>package</phase>
                        <goals>
                            <goal>package</goal>
                        </goals>
                        <configuration>
                            <platform>windows</platform>
                            <!--生成压缩包-->
                            <createZipball>true</createZipball>
                            <!--vm参数-->
<!--                            <vmArgs>-XX:+UseZGC</vmArgs>-->
                        </configuration>
                    </execution>
                </executions>
            </plugin>

What is the expected behavior?

What is the current behavior?

Do you have outputs, screenshots, demos or samples which demonstrate the problem or enhancement?

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

Other information (e.g. related issues, suggestions how to fix, links for us to have context)

[INFO]     Generating MSI merge module...
[INFO]         WXS file generated in D:\IdeaProjects\javaFx\demo\target\assets\fx-project.msm.wxs!
[INFO]         Compiling file D:\IdeaProjects\javaFx\demo\target\assets\fx-project.msm.wxs
[INFO]         Executing command: cmd.exe /s /c "candle -out D:\IdeaProjects\javaFx\demo\target\assets\fx-project.msm.wixobj D:\IdeaProjects\javaFx\demo\target\assets\fx-project.msm.wxs"
[ERROR]         'candle' �����ڲ����ⲿ���Ҳ���ǿ����еij���
[ERROR]         ���������ļ���
[ERROR]     MSI merge module generation failed due to: Command execution failed: candle -out D:\IdeaProjects\javaFx\demo\target\assets\fx-project.msm.wixobj D:\IdeaProjects\javaFx\demo\target\assets\fx-project.msm.wxs
[ERROR] 
org.codehaus.plexus.util.cli.CommandLineException: Command execution failed: candle -out D:\IdeaProjects\javaFx\demo\target\assets\fx-project.msm.wixobj D:\IdeaProjects\javaFx\demo\target\assets\fx-project.msm.wxs
    at io.github.fvarrui.javapackager.utils.CommandUtils.executeOnDirectory (CommandUtils.java:20)
    at io.github.fvarrui.javapackager.utils.CommandUtils.execute (CommandUtils.java:30)
    at io.github.fvarrui.javapackager.packagers.GenerateMsm.doApply (GenerateMsm.java:59)
    at io.github.fvarrui.javapackager.packagers.GenerateMsm.doApply (GenerateMsm.java:15)
    at io.github.fvarrui.javapackager.packagers.ArtifactGenerator.apply (ArtifactGenerator.java:44)
    at io.github.fvarrui.javapackager.packagers.Packager.generateInstallers (Packager.java:440)
    at io.github.fvarrui.javapackager.maven.PackageMojo.execute (PackageMojo.java:387)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:190)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:186)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:539)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1136)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:635)
    at java.lang.Thread.run (Thread.java:833)
[INFO]     
[INFO]     Generating MSI installer...
[INFO]         WXS file generated in D:\IdeaProjects\javaFx\demo\target\assets\fx-project.msm.wxs!
[INFO]         Compiling file D:\IdeaProjects\javaFx\demo\target\assets\fx-project.msm.wxs
[INFO]         Executing command: cmd.exe /s /c "candle -out D:\IdeaProjects\javaFx\demo\target\assets\fx-project.msm.wixobj D:\IdeaProjects\javaFx\demo\target\assets\fx-project.msm.wxs"
[ERROR]         'candle' �����ڲ����ⲿ���Ҳ���ǿ����еij���
[ERROR]         ���������ļ���
[ERROR]     MSI installer generation failed due to: Command execution failed: candle -out D:\IdeaProjects\javaFx\demo\target\assets\fx-project.msm.wixobj D:\IdeaProjects\javaFx\demo\target\assets\fx-project.msm.wxs
[ERROR] 
org.codehaus.plexus.util.cli.CommandLineException: Command execution failed: candle -out D:\IdeaProjects\javaFx\demo\target\assets\fx-project.msm.wixobj D:\IdeaProjects\javaFx\demo\target\assets\fx-project.msm.wxs
    at io.github.fvarrui.javapackager.utils.CommandUtils.executeOnDirectory (CommandUtils.java:20)
    at io.github.fvarrui.javapackager.utils.CommandUtils.execute (CommandUtils.java:30)
    at io.github.fvarrui.javapackager.packagers.GenerateMsm.doApply (GenerateMsm.java:59)
    at io.github.fvarrui.javapackager.packagers.GenerateMsi.doApply (GenerateMsi.java:40)
    at io.github.fvarrui.javapackager.packagers.GenerateMsi.doApply (GenerateMsi.java:16)
    at io.github.fvarrui.javapackager.packagers.ArtifactGenerator.apply (ArtifactGenerator.java:44)
    at io.github.fvarrui.javapackager.packagers.Packager.generateInstallers (Packager.java:440)
    at io.github.fvarrui.javapackager.maven.PackageMojo.execute (PackageMojo.java:387)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:190)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:186)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:539)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1136)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:635)
    at java.lang.Thread.run (Thread.java:833)
[INFO]     
[INFO] Installers generated! []
[INFO] 
[INFO] Creating bundles ...
[INFO] Reading assembly descriptor: D:\IdeaProjects\javaFx\demo\target\assets\assembly-zipball-windows.xml
[INFO] Building zip: D:\IdeaProjects\javaFx\demo\target\fx-project-1.0-SNAPSHOT-windows.zip
[INFO]     Zipball created: D:\IdeaProjects\javaFx\demo\target\fx-project-1.0-SNAPSHOT-windows.zip
[INFO] Bundles created!
fvarrui commented 1 year ago

Hi @minliuhua! candle and light directory must be on PATH env variable:

image

armin-reichert commented 1 year ago

I had the same issue, it should probably be added to the documentation.

fvarrui commented 1 year ago

Or maybe show a warning message with this suggestion next to the exception?

armin-reichert commented 1 year ago

Or both :-) Adding a hint to the documentation is probably easiest.

fvarrui commented 1 year ago

image

Done!