JavaPackager icon indicating copy to clipboard operation
JavaPackager copied to clipboard

Packaging under MacOS failed

Open peiwuqing opened this issue 3 years ago • 4 comments

Hi This is my profile

image

An error is reported after "MVN package" is executed. The error is as follows

[ERROR] net.sf.launch4j.BuilderException: net.sf.launch4j.ExecException: Exec failed (1): /Users/apple/Documents/soft/maven/repo/net/sf/launch4j/launch4j/3.14/launch4j-3.14-workdir-mac/bin/windres --preprocessor=cat -J rc -O coff -F pe-i386 /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/launch4j5353394131862792778rc /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/launch4j6836699587591327243o at net.sf.launch4j.Builder.build (Builder.java:149) at com.akathist.maven.plugins.launch4j.Launch4jMojo.doExecute (Launch4jMojo.java:439) at com.akathist.maven.plugins.launch4j.Launch4jMojo.execute (Launch4jMojo.java:328) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137) at org.twdata.maven.mojoexecutor.MojoExecutor.executeMojo (MojoExecutor.java:119) at io.github.fvarrui.javapackager.maven.CreateWindowsExeLaunch4j.doApply (CreateWindowsExeLaunch4j.java:106) at io.github.fvarrui.javapackager.maven.CreateWindowsExeLaunch4j.doApply (CreateWindowsExeLaunch4j.java:29) at io.github.fvarrui.javapackager.packagers.ArtifactGenerator.apply (ArtifactGenerator.java:44) at io.github.fvarrui.javapackager.maven.MavenContext.createWindowsExe (MavenContext.java:76) at io.github.fvarrui.javapackager.packagers.WindowsPackager.doCreateApp (WindowsPackager.java:77) at io.github.fvarrui.javapackager.packagers.Packager.createApp (Packager.java:413) at io.github.fvarrui.javapackager.maven.PackageMojo.execute (PackageMojo.java:376) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288) at org.apache.maven.cli.MavenCli.main (MavenCli.java:192) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356) Caused by: net.sf.launch4j.ExecException: Exec failed (1): /Users/apple/Documents/soft/maven/repo/net/sf/launch4j/launch4j/3.14/launch4j-3.14-workdir-mac/bin/windres --preprocessor=cat -J rc -O coff -F pe-i386 /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/launch4j5353394131862792778rc /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/launch4j6836699587591327243o at net.sf.launch4j.Util.exec (Util.java:156) at net.sf.launch4j.Cmd.exec (Builder.java:215) at net.sf.launch4j.Builder.build (Builder.java:100) at com.akathist.maven.plugins.launch4j.Launch4jMojo.doExecute (Launch4jMojo.java:439) at com.akathist.maven.plugins.launch4j.Launch4jMojo.execute (Launch4jMojo.java:328) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137) at org.twdata.maven.mojoexecutor.MojoExecutor.executeMojo (MojoExecutor.java:119) at io.github.fvarrui.javapackager.maven.CreateWindowsExeLaunch4j.doApply (CreateWindowsExeLaunch4j.java:106) at io.github.fvarrui.javapackager.maven.CreateWindowsExeLaunch4j.doApply (CreateWindowsExeLaunch4j.java:29) at io.github.fvarrui.javapackager.packagers.ArtifactGenerator.apply (ArtifactGenerator.java:44) at io.github.fvarrui.javapackager.maven.MavenContext.createWindowsExe (MavenContext.java:76) at io.github.fvarrui.javapackager.packagers.WindowsPackager.doCreateApp (WindowsPackager.java:77) at io.github.fvarrui.javapackager.packagers.Packager.createApp (Packager.java:413) at io.github.fvarrui.javapackager.maven.PackageMojo.execute (PackageMojo.java:376) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288) at org.apache.maven.cli.MavenCli.main (MavenCli.java:192) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356) [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4.186 s [INFO] Finished at: 2022-09-02T18:02:34+08:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal io.github.fvarrui:javapackager:1.6.7:package (default) on project xb-print: org.apache.maven.plugin.MojoExecutionException: Failed to build the executable; please verify your configuration.: net.sf.launch4j.ExecException: Exec failed (1): /Users/apple/Documents/soft/maven/repo/net/sf/launch4j/launch4j/3.14/launch4j-3.14-workdir-mac/bin/windres --preprocessor=cat -J rc -O coff -F pe-i386 /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/launch4j5353394131862792778rc /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/launch4j6836699587591327243o -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

I need your help urgently. Thank you!

  • JavaPackager version:1.6.7
  • OS version: MacOS Catalina 10.15.7
  • JDK version: 1.8.0_191
  • Build tool:
    • [x] Maven

peiwuqing avatar Sep 02 '22 10:09 peiwuqing

Hi @peiwuqing!

Are you sure that the icon (winConfig.icoFile) is an ICO file?

Another thing: I guess you are packaging your app for Windows, but ... are you bundling a JRE for Mac OS? You should download a Java runtime for Windows and use it instead of the Mac OS one.

fvarrui avatar Sep 02 '22 16:09 fvarrui

Hi @fvarrui

I'm sure I must be using an ICO file. Because I saw this solution on StackOverflow and converted it according to the provided ICO address.

I tried to download the same version of JDK for windows, but the error remained

image

peiwuqing avatar Sep 03 '22 03:09 peiwuqing

Hi @peiwuqing!

I'm sure I must be using an ICO file. Because I saw this solution on StackOverflow and converted it according to the provided ICO address.

Ok. Please, could you try to run the next command (highlighted) just after the building process fails? Maybe this way we can figure out what is happening with windres command.

image

I tried to download the same version of JDK for windows, but the error remained

Yes, this will only give you problems when trying to run your application on Windows.

fvarrui avatar Sep 03 '22 09:09 fvarrui

Hi @fvarrui I have tried to run it. Please see the picture for the result image

Please help me see if there is any solution

peiwuqing avatar Sep 03 '22 13:09 peiwuqing

Hi @peiwuqing!

Sorry for my soooooo late reply.

Two suggestions:

  • Remove your ICO and try again.
  • Try to package your app using -X option for a full debug logging (and the nyou can share it here, please)

fvarrui avatar Nov 28 '22 18:11 fvarrui

I close this issue due to lack of activity. Please, feel free to reopen it if the problem persists. Thanks!

fvarrui avatar Feb 07 '23 22:02 fvarrui