使用maven在exe文件中打包java文件 [英] Package java files in exe for windows with maven
本文介绍了使用maven在exe文件中打包java文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Maven的Launch4J端口记录非常严格,但我没有按照我想要的方式使用它。
The Launch4J port for Maven is terribly documented and I fail to use it in the way I want.
是否有一些好的Maven插件可用于生成exe文件以下标准(如果可能,至少部分标准):
Is there some good Maven plugin to gernerate an exe file with following criteria (at least some of them, if possible):
- 没有包装罐子
- Jars可以位于相对于jar文件的不同目录中
- jars正是依赖项,因此将新jar添加到具有不同名称的目录中没有任何效果。
- 可以通过文件配置Xmx和Xms
- 如果可能,进程以.exe名称运行(不是那么重要)
- No wrapping of jars
- Jars can be in different directories relative to the jar file
- The jars are exactly the dependancies, so adding new jars to a directory with a different name does not have any effect.
- Xmx and Xms can be configured through a file
- Process runs under the .exe name if possible (not so important)
推荐答案
你可以使用插件
<plugin>
<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<version>1.5.2</version>
</plugin>
用于将jar文件包装在exe中。
for wrapping your jar files in an exe.
事先你可以把所有东西都装在一个罐子里,如 aberes 的答案所述。
Beforehand you could wrap up everything in one jar like described in the answer of aberes.
因此,例如,配置可能如下所示:
So, for example, a configuration could look like this:
<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>
这篇关于使用maven在exe文件中打包java文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文