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

时间:2014-03-28 12:52:34

标签: java maven exe

我想用Maven为我的项目创建* .exe文件。我使用launch4j-maven-plugin并且它有效,但它需要fileVersionproductVersion的格式为“x.x.x.x”。我需要fileVersion为“x.x.x”,productVersion为“x.x.x.x”。我可以更改此格式吗? 我的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>

我的例外:

[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'

可能是另一个用于create * .exe文件的maven插件吗?

1 个答案:

答案 0 :(得分:0)

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

您还需要在pom.xml中配置此插件