使用launch4j和maven时不会创建.exe

时间:2014-08-21 09:11:38

标签: java maven exe launch4j

我正在尝试使用 launch4j Maven 为我的 JAVA 项目创建一个exe文件。

这是我的 pom.xml

 <build>
    <pluginManagement>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.0</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.3.2</version>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.4</version>
            <configuration>
                <descriptorRefs>
                    <descriptortRef>jar-with-dependencies</descriptortRef>
                </descriptorRefs>
                <archive>
                    <manifest>
                        <mainClass>dev.main.App</mainClass>
                    </manifest> 
                </archive>
            </configuration>
            <executions>
                <execution>
                    <id>make-assembly</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>1.7.1</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <shadedArtifactAttached>true</shadedArtifactAttached>
                <shadedClassifierName>shaded</shadedClassifierName>
                <transformers>
                    <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                        <mainClass>dev.main.App</mainClass>
                    </transformer>
                </transformers>
            </configuration>
        </plugin>

        <plugin>
            <groupId>com.akathist.maven.plugins.launch4j</groupId>
            <artifactId>launch4j-maven-plugin</artifactId>
            <version>1.5.1</version>
            <executions>
                <execution>
                    <id>l4j-clui</id>
                    <phase>package</phase>
                    <goals>
                        <goal>launch4j</goal>
                    </goals>
                    <configuration>
                        <headerType>console</headerType>
                        <jar>${project.build.directory}/target/App-jar-with-dependencies.jar</jar>
                        <outfile>${project.build.directory}/target/App.exe</outfile>
                        <downloadUrl>http://java.com/download</downloadUrl>
                        <classPath>
                            <mainClass>dev.main.App</mainClass>
                        </classPath>
                        <jre>
                            <minVersion>1.6.0</minVersion>
                            <jdkPreference>preferJre</jdkPreference>
                        </jre>
                        <versionInfo>
                            <fileVersion>1.0.0.0</fileVersion>
                            <txtFileVersion>${project.version}</txtFileVersion>
                            <fileDescription>${project.name}</fileDescription>
                            <copyright>C</copyright>
                            <productVersion>1.0.0.0</productVersion>
                            <txtProductVersion>1.0.0.0</txtProductVersion>
                            <productName>${project.name}</productName>
                            <internalName>AppName</internalName>
                            <originalFilename>App.exe</originalFilename>
                        </versionInfo>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
   </pluginManagement>
</build>

我运行:mvn clean compile assembly:single来创建包含所有Maven依赖项的 jar 应用。

要创建 .exe ,我执行:mvn package但在目标文件夹下没有创建任何内容。

我错过了目标或配置吗?

伊斯梅尔

1 个答案:

答案 0 :(得分:1)

好吧,我不是maven的专家,但<pluginManagement>标签看起来很可疑。当我获得Maven POM documentation权限时,您需要一个普通的<plugins>元素。

相关问题