简体   繁体   English

Maven-无法使用Java 10执行目标org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile

[英]Maven - Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile Using java 10

im trying to upload my discord bot project to Heroku using Git bash My project is java 10 and im using Maven but i get this error : 我正在尝试使用Git bash将不和谐的bot项目上传到Heroku我的项目是java 10,我正在使用Maven,但出现此错误:

remote:        [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project bot_discord: Fatal error compiling: invalid flag: --release -> [Help 1]
remote:        [ERROR]
remote:        [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
remote:        [ERROR] Re-run Maven using the -X switch to enable full debug logging.
remote:        [ERROR]
remote:        [ERROR] For more information about the errors and possible solutions, please read the following articles:
remote:        [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
remote:
remote:  !     ERROR: Failed to build app with Maven
remote:        We're sorry this build is failing! If you can't find the issue in application code,
remote:        please submit a ticket so we can help: https://help.heroku.com/
remote:
remote:  !     Push rejected, failed to compile Java app.
remote:
remote:  !     Push failed

i think i need to add something to my Pom.xml but i dont understand what to add ! 我想我需要向我的Pom.xml添加一些内容,但我不知道要添加什么! my pom.xml : 我的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>kino.bot</groupId>
  <artifactId>bot_discord</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>Bot Ryo</name>
  <description>Mon bot</description>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.7.0</version>
        <configuration>
          <release>10</release>
        </configuration>
      </plugin>
    </plugins>
  </build>


  <repositories>
    <repository>
        <id>jcenter</id>
        <name>jcenter-bintray</name>
        <url>http://jcenter.bintray.com</url>
    </repository>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
  </repositories>

  <dependencies>
    <dependency>
        <groupId>net.dv8tion</groupId>
        <artifactId>JDA</artifactId>
        <version>3.7.1_422</version>
    </dependency>
    <dependency>
        <groupId>com.mashape.unirest</groupId>
        <artifactId>unirest-java</artifactId>
        <version>1.4.9</version>
    </dependency>
  </dependencies>

</project>

what do i need to add to my pom.xml ? 我需要添加什么到我的pom.xml中?

The -release argument is supported only since Java9 ( https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html ). 仅从Java9开始才支持-release参数( https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html )。 Make sure your maven installation is using at least Java9. 确保您的maven安装至少使用Java9。

Ensure that you have system.properties file in the root directory of your repository with the following contents: 确保存储库的根目录中具有system.properties文件,其中包含以下内容:

java.runtime.version=10

For more info see the Heroku documentation on Java versions 有关更多信息,请参见有关Java版本Heroku文档。

Try using version 3.8.0 instead of 3.7.0. 尝试使用版本3.8.0而不是版本3.7.0。 Also make sure your JAVA_HOME is set to your Java 8 installation. 还要确保将JAVA_HOME设置为Java 8安装。 See this link 看到这个链接

There's another option instead of adding the properties file in the repo location. 除了在回购位置添加属性文件外,还有另一种选择。

You can add this code in POM.xml: 您可以在POM.xml中添加以下代码:

<properties>
    <java.version>1.8.0_171</java.version>
</properties>

Remove <release>10</release> from pom.xml and add system.properties in resources with content java.runtime.version=10 . 从pom.xml中删除<release>10</release> ,并在内容为java.runtime.version=10资源中添加system.properties It should work with jdk 10. Or you can change the JDK as per your need. 它应该与jdk 10一起使用。或者,您可以根据需要更改JDK。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法在项目上执行目标org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile(default-compile) - Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project Maven:未能执行目标 org.apache.maven.plugins:maven-compiler-plugin:3.10.1compile: - Maven: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile Intelij IDEA-无法执行目标org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile - Intelij IDEA - Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile 无法执行目标org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile - Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile 无法执行目标org.apache.maven.plugins:maven-compiler-plugin:3.1:compile - Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile 未能执行目标 org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile - Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile 无法使用 MAVEN 构建并出现错误 - 无法执行目标 org.apache.maven.plugins:maven-compiler-plugin:3.1:compile - Unable to Build using MAVEN with ERROR - Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile 无法使用MAVEN进行编译并出现错误-无法执行目标org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile - Unable to Build using MAVEN with ERROR - Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile Maven构建错误:无法执行目标org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile - Maven build error: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile Maven编译错误-无法执行目标org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile - maven compilation error - Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM