gpt4 book ai didi

JavaFX Maven jfx :jar error: Could not find artifact javafx-packager

转载 作者:行者123 更新时间:2023-12-02 10:42:26 43 4
gpt4 key购买 nike

我正在尝试使用 JavaFX 和 Maven 构建一个可执行文件。

'clean javafx:ru​​n' 工作正常,但是当我运行 'mvn clean jfx:jar'(在 eclipse 或 cmd 中)时,我收到此错误:

[ERROR] Failed to execute goal com.zenjava:javafx-maven-plugin:8.8.3:jar (default-cli) on project inkoop: Execution default-cli of goal com.zenjava:javafx-maven-plugin:8.8.3:jar failed: Plugin com.zenjava:javafx-maven-plugin:8.8.3 or one of its dependencies could not be resolved: Could not find artifact javafx-packager:javafx-packager:jar:1.8.0_20 at specified path C:\Program Files\Java\jdk-13.0.2/../lib/ant-javafx.jar -> [Help 1]

.
pom.xml:
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>


<groupId>nl.myname.programs</groupId>
<artifactId>name</artifactId>
<version>0.0.1-SNAPSHOT</version>


<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>


<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>13</version>
</dependency>

<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>13</version>
</dependency>
</dependencies>


<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>

<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.4</version>
<configuration>
<mainClass>nl.myname.programs.name.App</mainClass>
<executable>C:/Program Files/Java/jdk-13.0.2/bin/java</executable>
</configuration>
</plugin>


<plugin>
<groupId>com.zenjava</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>8.8.3</version>
<configuration>
<jfxMainAppJarName>${project.build.finalName}.jar</jfxMainAppJarName>
<mainClass>nl.myname.programs.name.App</mainClass>
</configuration>
</plugin>



</plugins>
</build>

我的路径都有 %JAVA_HOME%\binC:\Program Files\apache-maven-3.6.3\bin (%JAVA_HOME 设置为 C:\Program Files\Java\jdk-13.0.2 )

有什么方法可以构建我的应用程序吗?
两个都需要吗 javax-maven-plugin的?
感谢您的帮助!

最佳答案

AFAIK,com.zenjava:javafx-maven-plugin不适用于 Java 11+/JavaFX 11+。
只需使用 org.openjfx:javafx-maven-plugin 使用 Java 11+/JavaFX 11+。

关于JavaFX Maven jfx :jar error: Could not find artifact javafx-packager,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60263852/

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