2012-01-20 2 views
3

Maven 용 Launch4J 포트는 끔찍하게 문서화되어 있으므로 원하는 방식으로 사용하지 못합니다. 항아리의 어떠한 포장이 Maven을 사용하는 Windows 용 exe의 패키지 java 파일

  • 항아리가를 기준으로 서로 다른 디렉토리에있을 수

    • :

      기준을 다음과 같이 EXE 파일을 gernerate하기 좋은 Maven 플러그인이 있나요 (가능하면 적어도 그들 중 일부는) jar 파일

    • jar는 정확하게 종속성이 있으므로 다른 jar를 다른 이름의 디렉토리에 추가해도 아무런 영향이 없습니다.
    • 의 -Xmx 및 XMS 파일
    • 과정을 통해 구성 할 수있는 두 가지 실행 한 지정과 함께, 당신은 받는다는 - 조립 플러그인을 사용할 수 있습니다
  • +3

    당신은 appassembler - 받는다는 - 플러그인을하는 ... 그것은 당신의 자바 응용 프로그램 배치/스크립트/JSW 파일을 생성하는 모습을 찍은 적이 있지만, exe 파일이 아닙니다. – khmarbaise

    +0

    jar 파일을 래핑하지 않고 이것이 어떻게 가능한지 모르겠습니다. –

    답변

    -1

    한 .exe 이름 (그렇게 중요하지 않음) 가능하다면에서 실행 메인 클래스와 하나의 항아리에 모든 의존성을 패키징하므로 ​​클래스 패스가 필요 없다. 두 번째 실행은 모든 구성 파일을 동일한 병에 넣습니다. 마지막으로 exe 파일이 없습니다. zip 파일에 매니페스트 파일이있는 병이 있습니다.

    <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-assembly-plugin</artifactId> 
        <version>2.2-beta-5</version> 
        <executions> 
        <execution> 
         <id>make-assembly1</id> 
         <phase>package</phase> 
         <goals> 
         <goal>single</goal> 
         </goals> 
         <configuration> 
         <archive> 
          <manifest> 
          <mainClass>com....class.with.the.main</mainClass> 
          </manifest> 
         </archive> 
         <descriptorRefs> 
          <descriptorRef>jar-with-dependencies</descriptorRef> 
         </descriptorRefs> 
         </configuration> 
        </execution> 
        <execution> 
         <id>make-assembly2</id> 
         <phase>package</phase> 
         <goals> 
         <goal>single</goal> 
         </goals> 
         <configuration> 
         <descriptors> 
          <descriptor>distribution.xml</descriptor> 
         </descriptors> 
         </configuration> 
        </execution> 
        </executions> 
    </plugin> 
    
    1

    당신은 EXE에서 jar 파일을 포장하기위한 플러그인

      <plugin> 
           <groupId>com.akathist.maven.plugins.launch4j</groupId> 
           <artifactId>launch4j-maven-plugin</artifactId> 
           <version>1.5.2</version> 
          </plugin> 
    

    를 사용할 수 있습니다.

    사전에 답변의 설명에있는 것처럼 모두 한 병에 포장 할 수 있습니다. aberes.

    그래서, 예를 들어, 구성은 다음과 같을 수 있습니다 :

        <plugin> 
            <groupId>com.akathist.maven.plugins.launch4j</groupId> 
            <artifactId>launch4j-maven-plugin</artifactId> 
            <executions> 
             <execution> 
              <id>l4j-clui</id> 
              <phase>install</phase> 
              <goals> 
               <goal>launch4j</goal> 
              </goals> 
              <configuration> 
               <!-- 
               <headerType>gui</headerType>  --> 
               <headerType>console</headerType> 
               <jar>target/yourFinalJar.jar</jar> 
               <outfile>target/${project.build.finalName}.exe</outfile> 
               <errTitle>${project.name}</errTitle> 
               <icon>your/Icon.ico</icon> 
               <jre> 
                <path>jre</path> <!-- if you bundle the jre --> 
               </jre> 
    
               <versionInfo> 
                <fileVersion>1.2.3.4</fileVersion> 
                <txtFileVersion>${project.version}</txtFileVersion> 
                <fileDescription>${project.description}</fileDescription> 
                <copyright>(c) ${project.inceptionYear} MyCompany</copyright> 
                <productVersion>1.0.0.0</productVersion> 
                <txtProductVersion>${project.version}</txtProductVersion> 
                <productName>${project.name}</productName> 
                <companyName>MyCompany</companyName> 
                <internalName>${project.name}</internalName> 
                <originalFilename>${project.build.finalName}.exe</originalFilename> 
               </versionInfo> 
              </configuration> 
             </execution> 
            </executions> 
           </plugin> 
    
    관련 문제