java - Java Maven 程序集插件致命错误编译:无效的目标版本 1.14
问题描述
我想使用 maven 程序集插件在 Intellij 中部署我的 javafx 项目,但是每当我尝试这样做时,我都会得到
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Battlesheet: Fatal error compiling: error: invalid target release: 1.14 -> [Help 1]
因此。我的pom如下:
<?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>org.Avalon</groupId>
<artifactId>Battlesheet</artifactId>
<version>1.0</version>
<name>Avalon Battlesheet</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.14</maven.compiler.source>
<maven.compiler.target>1.14</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>15-ea+6</version>
<classifier>win</classifier>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>15-ea+6</version>
<classifier>mac</classifier>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>15-ea+6</version>
<classifier>linux</classifier>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>13</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>15-ea+6</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.4</version>
<configuration>
<mainClass>assembly.Launcher</mainClass>
<launcher>launch.sh</launcher>
<compress>2</compress>
<jlinkZipName>avalon-battlesheet</jlinkZipName>
<jlinkImageName>avalon-battlesheet</jlinkImageName>
<noManPages>true</noManPages>
<noHeaderFiles>true</noHeaderFiles>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>create-executable</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<outputDirectory>${test.pack.dir}</outputDirectory>
<appendAssemblyId>false</appendAssemblyId>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>assembly.Launcher</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
我知道已经有很多这样的问题了,但我至少通读了其中的大部分,但无济于事。我的路径和 JAVA_HOME 都设置为我唯一的 JDK(AdoptOpenJDK 1.14),我的项目结构应该尽可能设置为 1.14,现在我的知识失败了,为什么它仍然告诉我我的目标版本无效。任何帮助,将不胜感激 :)
解决方案
看起来您正在尝试使用 Java 14 进行构建。1.
不再使用前缀 (aka ),因此请尝试更改1.14
为14
.
推荐阅读
- rsyslog - 从 Zscaler 接收日志时,文件名 Ubuntu rsyslog 中的特殊字符是什么?
- javascript - 如何从父 div 获取特定子元素的内部元素 - selenium javascript
- c++ - 带花括号的引用类型变量上的 decltype
- python - 在 sympy 中解决的性能问题
- command-line-interface - 如何使用 Azure DevOps cli 检索工作项的 Azure DevOps 版本
- r - 复制的 ggplot-object 与原始对象部分链接
- node.js - 未捕获的类型错误:$ 不是 core-js 中的函数
- asp.net-mvc - 如何获取asp.net mvc表中的总行值
- r - dplyr R 包的 bind_rows 更改列名,如果它们是数字
- mysql - 在 nodejs 中,如何使用 sequelize.bulkcreate 将数据插入 MySQL?