gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 12:37:45 24 4
gpt4 key购买 nike

我正在尝试使用 launch4jMaven 为我的 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 cleancompile assembly:single来创建具有所有Maven依赖项的jar应用程序。

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

我是否缺少目标或配置?

伊斯梅尔

最佳答案

嗯,我不是 Maven 专家,但是 <pluginManagement>标签对我来说看起来很可疑。当我得到Maven POM documentation时是的,你想要一个普通的 <plugins>元素。

关于java - 使用launch4j和maven时不会创建.exe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25422433/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com