Java 用于创建*.exe文件的Maven插件

Java 用于创建*.exe文件的Maven插件,java,maven,exe,Java,Maven,Exe,我想用Maven为我的项目创建*.exe文件。我使用launch4jmaven插件,它可以工作,但它需要fileVersion和productVersion的格式为“x.x.x.x”。我需要fileVersion作为“x.x.x”和productVersion作为“x.x.x.x”。我可以更改这个格式吗? My pom.xml: <plugin> <groupId>com.akathist.maven.plugins.launch4j</gr

我想用Maven为我的项目创建*.exe文件。我使用
launch4jmaven插件
,它可以工作,但它需要
fileVersion
productVersion
的格式为“x.x.x.x”。我需要
fileVersion
作为“x.x.x”和
productVersion
作为“x.x.x.x”。我可以更改这个格式吗? My pom.xml:

<plugin>
            <groupId>com.akathist.maven.plugins.launch4j</groupId>
            <artifactId>launch4j-maven-plugin</artifactId>
            <version>1.5.2</version>
            <executions>
                <execution>
                    <id>l4j-clui</id>
                    <phase>package</phase>
                    <goals>
                        <goal>launch4j</goal>
                    </goals>
                    <configuration>
                        <headerType>gui</headerType>
                        <jar>${project.build.directory}/${project.build.finalName}-jar-with-dependencies.jar</jar>
                        <outfile>${project.build.directory}/${exeFileName}.exe</outfile>
                        <downloadUrl>http://java.com/download</downloadUrl>
                        <classPath>
                            <mainClass>MainClass</mainClass>
                            <preCp>anything</preCp>
                        </classPath>
                        <icon>${project.basedir}/src/main/assembly/application.ico</icon>
                        <jre>
                            <minVersion>1.7.0_00</minVersion>
                            <jdkPreference>preferJre</jdkPreference>
                        </jre>
                        <versionInfo>
                            <fileVersion>${project.version}.${buildNumber}</fileVersion>
                            <txtFileVersion>txtFileVersion</txtFileVersion>
                            <fileDescription>${product.name}</fileDescription>
                            <copyright>${project.organization.name}</copyright>
                            <productVersion>${project.version}</productVersion>
                            <txtProductVersion>txtProductVersion</txtProductVersion>
                            <productName>${product.name}</productName>
                            <companyName>${product.company}</companyName>
                            <internalName>abc</internalName>
                            <originalFilename>${exeFileName}.exe</originalFilename>
                        </versionInfo>
                    </configuration>
                </execution>
            </executions>
        </plugin>

是否存在用于创建*.exe文件的另一个maven插件?

尝试mvn程序集:single。它专门用于创建可执行jar文件


你还需要在pom.xml中配置这个插件,我用它来创建jar,但我想创建*.exe文件。你在问题中已经告诉过你需要创建一个可执行jar,你可以使用上面的插件。我写的是可执行文件,不是jar。更正。据我所知,maven汇编插件无法设置文件版本。
[ERROR] Failed to execute goal com.akathist.maven.plugins.launch4j:launch4j-maven-plugin:1.5.2:launch4j (l4j-clui) on project MyProject: Failed to build the executable; please verify your configuration. Invalid data: File version, should be 'x.x.x.x'