有效解決辦法:marven:Fatal error compiling: 無效的目標發行版: 11

具體錯誤:java

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:testCompile (default-testCompile) on project teavm-tests: Fatal error compiling: 無效的目標發行版: 11 -> [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] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :teavm-tests

打開對應的pom.xml,有以下內容:apache

<plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>${maven-compiler-plugin.version}</version>
          <configuration>
            <source>${java-tests.version}</source>
            <target>${java-tests.version}</target>
          </configuration>
        </plugin>

把source/target改成1.8是不對的。在pom.xml中應該有相似以下的配置:bash

<java.version>1.8</java.version>
    <java-tests.version>11</java-tests.version>

吾把11改爲1.8,就報一些接口找不到。因此,吾解決辦法是提升了java.version。maven

相關文章
相關標籤/搜索