微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Maven 无效目标发布:13

如何解决Maven 无效目标发布:13

我在 Eclipse 中使用 Maven,我想用 Java13 运行我的项目。每次我构建我的项目时,我都会收到以下错误消息:

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project subscriptionsmanager: Fatal error compiling: invalid target release: 13 -> [Help 1]

我在 <properties> 中配置了我的 pom.xml 文件,如下所示:

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

从 Eclipse 的“Java 构建路径”部分将 Java13 作为 JRE 来自 Eclipse。

enter image description here

有没有我没有考虑过的设置?

解决方法

正如 naman 所建议的,您需要显式配置您的 Maven 编译器插件:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <source>13</source>
                <target>13</target>
            </configuration>
        </plugin>
...

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。