2015-05-26 6 views
0

У меня есть проект, написанный на java с использованием javafx в основном. Проблема заключается в том, когда я пытаюсь упаковать его в .exe Я постоянно получаю следующее сообщение об ошибке:Ошибка упаковки maven project: launch4j.BuilderException

[ERROR] 
    net.sf.launch4j.BuilderException: net.sf.launch4j.ExecException: Exec failed (1): C:\Users\Михаил\.m2\repository\com\aka 
    thist\maven\plugins\launch4j\launch4j-maven-plugin\1.5.1\launch4j-maven-plugin-1.5.1-workdir-win32\bin\windres.exe --pre 
    processor=type -J rc -O coff -F pe-i386 C:\Users\8FEE~1\AppData\Local\Temp\launch4j7244992626989978492rc C:\Users\8FEE~1 
    \AppData\Local\Temp\launch4j4703142106425399337o 
      at net.sf.launch4j.Builder.build(Builder.java:144) 
      at com.akathist.maven.plugins.launch4j.Launch4jMojo.execute(Launch4jMojo.java:353) 
      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132) 
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) 
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) 
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) 
      at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder. 
    java:51) 
      at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120) 
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347) 
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154) 
      at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582) 
      at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214) 
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:158) 
      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:483) 
      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): C:\Users\Михаил\.m2\repository\com\akathist\maven\plugins\lau 
    nch4j\launch4j-maven-plugin\1.5.1\launch4j-maven-plugin-1.5.1-workdir-win32\bin\windres.exe --preprocessor=type -J rc -O 
    coff -F pe-i386 C:\Users\8FEE~1\AppData\Local\Temp\launch4j7244992626989978492rc C:\Users\8FEE~1\AppData\Local\Temp\lau 
    nch4j4703142106425399337o 
      at net.sf.launch4j.Util.exec(Util.java:148) 
      at net.sf.launch4j.Cmd.exec(Builder.java:205) 
      at net.sf.launch4j.Builder.build(Builder.java:97) 
      ... 22 more 

здесь строится часть моего .pom в:

<build> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>2.5.1</version> 
       <configuration> 
        <source>1.8</source> 
        <target>1.8</target> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-dependency-plugin</artifactId> 
       <version>2.6</version> 
       <executions> 
        <execution> 
         <id>unpack-dependencies</id> 
         <phase>package</phase> 
         <goals> 
          <goal>unpack-dependencies</goal> 
         </goals> 
         <configuration> 
          <excludeScope>system</excludeScope> 
          <excludeGroupIds>junit,org.mockito,org.hamcrest</excludeGroupIds> 
          <outputDirectory>${project.build.directory}/classes</outputDirectory> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 
      <plugin> 
       <groupId>org.codehaus.mojo</groupId> 
       <artifactId>exec-maven-plugin</artifactId> 
       <version>1.2.1</version> 
       <executions> 
        <execution> 
         <id>unpack-dependencies</id> 

         <phase>package</phase> 
         <goals> 
          <goal>exec</goal> 
         </goals> 
         <configuration> 
          <executable>${java.home}/../bin/javafxpackager</executable> 
          <arguments> 
           <argument>-createjar</argument> 
           <argument>-nocss2bin</argument> 
           <argument>-appclass</argument> 
           <argument>${mainClass}</argument> 
           <argument>-srcdir</argument> 
           <argument>${project.build.directory}/classes</argument> 
           <argument>-outdir</argument> 
           <argument>${project.build.directory}</argument> 
           <argument>-outfile</argument> 
           <argument>${project.build.finalName}.jar</argument> 
          </arguments> 
         </configuration> 
        </execution> 
        <execution> 
         <id>default-cli</id> 
         <goals> 
          <goal>exec</goal>        
         </goals> 
         <configuration> 
          <executable>${java.home}/bin/java</executable> 

         </configuration> 
        </execution> 
       </executions> 
      </plugin> 

      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-surefire-plugin</artifactId> 
       <version>2.16</version> 
       <configuration> 
        <additionalClasspathElements> 
         <additionalClasspathElement>${java.home}/lib/jfxrt.jar</additionalClasspathElement> 
        </additionalClasspathElements> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-shade-plugin</artifactId> 
       <version>1.7.1</version> 
       <executions> 
        <execution> 
         <phase>package</phase> 
         <goals> 
          <goal>shade</goal> 
         </goals> 
        </execution> 
       </executions> 
       <configuration> 
        <shadedArtifactAttached>true</shadedArtifactAttached> 
        <shadedClassifierName>shaded</shadedClassifierName> 
        <transformers> 
         <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> 
          <mainClass>com.ediagent.edi.gui.Main</mainClass> 
         </transformer> 
        </transformers> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>com.akathist.maven.plugins.launch4j</groupId> 
       <artifactId>launch4j-maven-plugin</artifactId> 
       <version>1.5.1</version> 
       <executions> 
        <execution> 
         <id>l4j-clui</id> 
         <phase>package</phase> 
         <goals> 
          <goal>launch4j</goal> 
         </goals> 
         <configuration> 
          <headerType>gui</headerType> 
          <jar>${project.build.directory}/${artifactId}-${version}-shaded.jar</jar> 
          <outfile>${project.build.directory}/hasCode.exe</outfile> 
          <downloadUrl>http://java.com/download</downloadUrl> 
          <classPath> 
           <mainClass>com.ediagent.edi.gui.Main</mainClass> 
           <preCp>anything</preCp> 
          </classPath> 
          <icon>src/main/resources/icon/edisoft_ediagent_new_logo.png</icon> 
          <jre> 
           <minVersion>1.6.0</minVersion> 
           <jdkPreference>preferJre</jdkPreference> 
          </jre> 
          <versionInfo> 
           <fileVersion>1.0.0.0</fileVersion> 
           <txtFileVersion>${project.version}</txtFileVersion> 
           <fileDescription>${project.name}</fileDescription> 
           <copyright>2012 hasCode.com</copyright> 
           <productVersion>1.0.0.0</productVersion> 
           <txtProductVersion>1.0.0.0</txtProductVersion> 
           <productName>${project.name}</productName> 
           <companyName>edisoft.ru</companyName> 
           <internalName>ediagent</internalName> 
           <originalFilename>ediagent.exe</originalFilename> 
          </versionInfo> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 
     </plugins> 
    </build> 

Я новичок используйте maven для расширения exe-файлов и поэтому не можете найти правильную информацию о том, как это сделать, поэтому я сожалею, если моя конфигурация в корне неверна. Я знаю, что лучше упаковать java-проекты в jar, но мне нужен exexly .exe-файл на выходе. поэтому, пожалуйста, указать мне на мои ошибки, если возможно

ответ

2

я получил подобную проблему, а packageing JavaFX приложения проблема была икона в формате PNG попытаться использовать этот launch4j plugin`

<plugin> 
     <groupId>com.akathist.maven.plugins.launch4j</groupId> 
     <artifactId>launch4j-maven-plugin</artifactId> 
     <version>1.7.10</version> 
     <executions> 
      <execution> 
       <id>l4j-clui</id> 
       <phase>package</phase> 
       <goals> 
        <goal>launch4j</goal> 
       </goals> 
       <configuration> 
        <headerType>gui</headerType> 
        <jar>${project.build.directory}/${artifactId}-${version}.jar</jar> 
        <outfile>${project.build.directory}/petrobiz.exe</outfile> 
        <downloadUrl>http://yoururl.com/download</downloadUrl> 
        <classPath> 
         <mainClass>yourmainclass</mainClass> 
         <preCp>anything</preCp> 
        </classPath> 
        <icon>${RESOURCE_PATH}\icon2.ico</icon> 
        <jre> 
         <minVersion>1.8.0</minVersion> 
         <jdkPreference>preferJre</jdkPreference> 
         <bundledJre64Bit>false</bundledJre64Bit> 
         <runtimeBits>64/32</runtimeBits> 
        </jre> 
        <versionInfo> 
         <fileVersion>1.0.0.0</fileVersion> 
         <txtFileVersion>${project.version}</txtFileVersion> 
         <fileDescription>${project.name}</fileDescription> 
         <copyright>2016 yoururl.com</copyright> 
         <productVersion>1.0.0.2</productVersion> 
         <txtProductVersion>1.0.0.0</txtProductVersion> 
         <productName>${project.name}</productName> 
         <companyName>yourcompany</companyName> 
         <internalName>name</internalName> 
         <originalFilename>exename.exe</originalFilename> 
        </versionInfo> 
       </configuration> 
      </execution> 
     </executions> 
    </plugin>`