2017-12-29 24 views
1

Maven 프로젝트를 사용하여 .exe 파일을 생성 해보십시오. 나는 내 의존성과 함께 올바른 항아리를 얻지 만, exe 파일을 얻지는 않는다. 그 밖에 할 일이 있습니까? 하지만 ..maven 프로젝트로 launch4j로 exe 생성

를 항상 내 pom.xml 파일에서 몇 가지 실수를했다

[INFO] Replacing D:\SpiralUpWorkspace\SpiralShareAutoTaskAllocation\target\SpiralShareAutoTaskAllocation-0.0.1-SNAPSHOT.jar with D:\SpiralUpWorkspace\SpiralShareAutoTaskAllocation\target\SpiralShareAutoTaskAllocation-0.0.1-SNAPSHOT-shaded.jar 
[INFO] 
[INFO] --- launch4j-maven-plugin:1.7.21:launch4j (l4j-clui) @ SpiralShareAutoTaskAllocation --- 
[INFO] Platform-specific work directory already exists: C:\Users\Admin\.m2\repository\net\sf\launch4j\launch4j\3.11\launch4j-3.11-workdir-win32 
[ERROR] 
net.sf.launch4j.BuilderException: Application jar doesn't exist. 
    at net.sf.launch4j.Builder.build(Builder.java:76) 
    at com.akathist.maven.plugins.launch4j.Launch4jMojo.execute(Launch4jMojo.java:403) 
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) 
    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:128) 
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) 
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) 
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) 
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862) 
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286) 
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:197) 
    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: 5.920 s 
[INFO] Finished at: 2017-12-29T12:30:13+05:30 
[INFO] Final Memory: 15M/46M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal com.akathist.maven.plugins.launch4j:launch4j-maven-plugin:1.7.21:launch4j (l4j-clui) on project SpiralShareAutoTaskAllocation: Failed to build the executable; please verify your configuration. Application jar doesn't exist. -> [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 

내 pom.xml 파일

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>com.spiralshare.autoallocation</groupId> 
    <artifactId>SpiralShareAutoTaskAllocation</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <name>SpiralShareAutoAllocation</name> 
    <description>SpiralShare Task Auto Allocation</description> 

    <url>http://maven.apache.org</url> 
    <properties> 
     <!-- Generic properties --> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <!-- Spring --> 
     <spring-framework.version>4.0.3.RELEASE</spring-framework.version> 

     <!-- Hibernate/JPA --> 
     <!-- <hibernate.version>4.3.5.Final</hibernate.version> --> 
     <hibernate.version>3.6.9.Final</hibernate.version> 

     <!-- Logging --> 
     <logback.version>1.0.13</logback.version> 
     <slf4j.version>1.7.5</slf4j.version> 
    </properties> 
    <dependencies> 

     <!-- Commons --> 
     <dependency> 
      <groupId>commons-collections</groupId> 
      <artifactId>commons-collections</artifactId> 
      <version>3.2.1</version> 
     </dependency> 


     <!-- Spring and Transactions --> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-context</artifactId> 
      <version>${spring-framework.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-tx</artifactId> 
      <version>${spring-framework.version}</version> 
     </dependency> 

     <!-- Spring ORM support --> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-orm</artifactId> 
      <version>${spring-framework.version}</version> 
     </dependency> 


     <!-- Hibernate --> 
     <dependency> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-entitymanager</artifactId> 
      <version>${hibernate.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-core</artifactId> 
      <version>${hibernate.version}</version> 
     </dependency> 

     <dependency> 
      <groupId>mysql</groupId> 
      <artifactId>mysql-connector-java</artifactId> 
      <version>5.1.9</version> 
     </dependency> 

     <dependency> 
      <groupId>commons-dbcp</groupId> 
      <artifactId>commons-dbcp</artifactId> 
      <version>1.4</version> 
     </dependency> 

    </dependencies> 

    <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-shade-plugin</artifactId> 
      <version>1.7.1</version> 
      <executions> 
       <execution> 
        <phase>package</phase> 
        <goals> 
         <goal>shade</goal> 
        </goals> 
       </execution> 
      </executions> 

     </plugin> 
     <plugin> 
      <groupId>com.akathist.maven.plugins.launch4j</groupId> 
      <artifactId>launch4j-maven-plugin</artifactId> 
      <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}/SpiralShareAutoAllocation.exe</outfile> 
         <downloadUrl>http://java.com/download</downloadUrl> 
         <classPath> 
          <mainClass>com.spiralshare.autoallocation.AutoAllocationMain</mainClass> 
          <preCp>anything</preCp> 
         </classPath> 
         <icon>application.ico</icon> 
         <jre> 
          <minVersion>1.8</minVersion> 
          <jdkPreference>preferJre</jdkPreference> 
         </jre> 
         <versionInfo> 
          <fileVersion>1.0.0.0</fileVersion> 
          <txtFileVersion>${project.version}</txtFileVersion> 
          <fileDescription>${project.name}</fileDescription> 
          <copyright>2017 spiraluplabs.com</copyright> 
          <productVersion>1.0.0.0</productVersion> 
          <txtProductVersion>1.0.0.0</txtProductVersion> 
          <productName>${project.name}</productName> 
          <companyName>SpiralUp</companyName> 
          <internalName>SpiralShareAutoAllocation</internalName> 
          <originalFilename>SpiralShareAutoAllocation.exe</originalFilename> 
         </versionInfo> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 
</build> 


</project> 

같은 예외를 launch4j 보여주는 것입니다,하지만 난 몰라

Pls, 의견을 보내주십시오.

감사합니다. jar 파일이 템플릿에 해당하는

답변

1

확인이 답변 : https://stackoverflow.com/a/4088861/5572007

당신은 "-shaded"접미사를 사용하면 안됩니다. 인용구 : "[Shaded plugin]은 일반적으로 jar 파일을/original-artifact-version.jar 파일로 이름을 변경하고 음영 처리 된 JAR 파일 이름을 target/artifact-version.jar"로 지정합니다. 대상 폴더에서 생성 된 jar 파일의 이름을 확인할 수 있습니다.

0

검사는 실제로 존재 :

${project.build.directory}/${artifactId}-${version}-shaded.jar 

당신은 모든 올바른을 확인하기 위해 구축 jar 파일에 하드 코딩의 전체 경로로이 템플릿을 대체하고 실행할 수 있습니다.

+0

thnks, @Anton Tupy. $ {project.build.directory}/$ {artifactId} - $ {version} -shaded.jar 항아리 생성되지 않습니다 .. 다른 방법을 알려주세요 ..? –