Maven的Launch4J端口記錄非常詳細,我無法按照自己想要的方式使用它。將exe文件打包成java文件
有一些很好的Maven插件來gernerate一個exe文件用以下標準(至少他們中的一些,如果可能的話):
- 罐子沒有包裝
- 罐可相對於不同的目錄該jar文件
- 罐子正是依賴關係,所以添加新罐子到不同名稱的目錄並沒有任何效果。
- XMX和X毫秒可通過文件
- 過程被配置下
Maven的Launch4J端口記錄非常詳細,我無法按照自己想要的方式使用它。將exe文件打包成java文件
有一些很好的Maven插件來gernerate一個exe文件用以下標準(至少他們中的一些,如果可能的話):
可以使用行家組裝-插件.exe名稱(如果可能不是那麼重要)運行時,與兩個執行一個指定主類並將所有依賴關係打包在一個jar中,所以你不需要任何類路徑。第二次執行會將所有配置文件放在同一個jar中。 因此finaly你沒有一個exe文件,你有一個壓縮文件清單文件的jar。
<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>
你可以使用插件
<plugin>
<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<version>1.5.2</version>
</plugin>
在一個EXE包裝的jar文件。
事先您可以將所有內容都包裝在一個罐子中,如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>
你已經採取了看看appassembler - Maven的插件...這將產生一批/腳本/ JSW文件是Java應用程序,但不是一個exe文件。 – khmarbaise
我不明白這是如何不包裝jar文件。 –