问题描述
我正在尝试使用 launch4j 插件从我的 Maven 项目生成一个 Windows exe。当我运行'mvn clean package'时,构建成功,并且正在输出一个jar(不会运行),但没有exe。注意:我在输出中看不到任何提及 launch4j 的内容。删除所有 mvn 插件(launch4j 除外)时的行为相同。
当我尝试运行“mvn package:launch4j”时,出现此错误:
[INFO] Scanning for projects...
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-Metadata.xml
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-Metadata.xml
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-Metadata.xml (14 kB at 3.1 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-Metadata.xml (20 kB at 4.5 kB/s)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.248 s
[INFO] Finished at: 2021-03-04T10:26:25Z
[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'package' in the current project and in the plugin groups [org.apache.maven.plugins,org.codehaus.mojo] available from the repositories [local (/Users/laWrencedonohoe/.m2/repository),central (https://repo.maven.apache.org/maven2)] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors,re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions,please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/nopluginFoundForPrefixException
larss-MacBook-Pro:COA_Translater laWrencedonohoe$
我的 pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>COA_Translater</groupId>
<artifactId>COA_Translater</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>COA_Translater</name>
<url>http://www.iress.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<encoding>UTF-8</encoding>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.9.1</version>
</plugin>
<!-- launch4j -->
<plugin>
<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<executions>
<execution>
<id>l4j-clui</id>
<phase>package</phase>
<goals>
<goal>launch4j</goal>
</goals>
<configuration>
<headerType>console</headerType>
<jar>target/COATranslater-0.0.3-SNAPSHOT-jar-with-dependencies.jar</jar>
<outfile>target/COATranslater.exe</outfile>
<downloadUrl>http://java.com/download</downloadUrl>
<classpath>
<mainClass>menu.COATranslater</mainClass>
</classpath>
<jre>
<bundledJre64Bit>false</bundledJre64Bit>
<bundledJreAsFallback>false</bundledJreAsFallback>
<minVersion>1.8.0</minVersion>
<jdkPreference>preferJre</jdkPreference>
<runtimeBits>32</runtimeBits>
</jre>
<versionInfo>
<fiLeversion>1.0.0.0</fiLeversion>
<txtFiLeversion>1.0.0.0</txtFiLeversion>
<fileDescription>COA_Translater</fileDescription>
<copyright>C</copyright>
<productVersion>1.0.0.0</productVersion>
<txtProductVersion>1.0.0.0</txtProductVersion>
<productName>COATranslater</productName>
<internalName>COATranslater</internalName>
<originalFilename>COATranslater.exe</originalFilename>
</versionInfo>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>menu.COATranslater</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>assembly</id>
<phase>package</phase>
<goals>
<goal>attached</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- launch4j ENDE -->
</plugins>
</pluginManagement>
</build>
</project>
仅供参考,我使用的是 mac。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)