执行目标失败…Maven, Heroku从GitHub部署



我有问题与Maven pom.xml文件,我无法理解…我用java创建了不和谐机器人,我想让它全天候在线。所以我在Heroku上找到了使用GitHub的教程。当我部署项目时,我得到这个错误:

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  6.970 s
[INFO] Finished at: 2022-07-15T15:44:01Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project gloombot: Fatal error compiling: invalid target release: 17 -> [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/MojoExecutionException
!     ERROR: Failed to build app with Maven
We're sorry this build is failing! If you can't find the issue in application code,
please submit a ticket so we can help: https://help.heroku.com/
!     Push rejected, failed to compile Java app.
!     Push failed

编辑: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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>gloombot</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/net.dv8tion/JDA -->
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.0.0-alpha.13</version>
</dependency>
</dependencies>

</project>

Java版本从终端:

julibut@Air-Juli gloombot % java -version
openjdk version "17.0.2" 2022-01-18
OpenJDK Runtime Environment (build 17.0.2+8-86)
OpenJDK 64-Bit Server VM (build 17.0.2+8-86, mixed mode, sharing)

我做了所有你想让我检查的东西的截图:

1. java项目

  1. 项目模块:资源项目设置:依赖项

  2. Java编译器

由于你使用的是IntelliJ,我已经得到了这个错误几次了这是我的TODO当我得到这个错误时,我经历了

  1. 检查项目版本和语言水平(项目结构>项目)
  2. 对模块(项目结构>Modules)不要忘记Dependencies选项卡在那里你可以找到模块SDK
  3. 检查Java编译器(设置>构建、执行、部署;编译器比;Java编译器)在那里你可以看到一个Project bytecode version&Per-module bytecode version→检查这些

希望这行得通

最新更新