有效解决办法:marven:Fatal error compiling: 无效的目标发行版: 11

简介: 有效解决办法:marven:Fatal error compiling: 无效的目标发行版: 11

具体错误:


[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,有如下内容:


 

<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中应该有类似如下的配置:


 

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

吾把11改成1.8,就报一些接口找不到。所以,吾解决办法是提高了java.version。

相关文章
解决办法:fatal error: SDL.h: 没有那个文件或目录
解决办法:fatal error: SDL.h: 没有那个文件或目录
416 0
前端报错 error: unknown option `-v' 解决方法
前端报错 error: unknown option `-v' 解决方法
2285 0
解决方案-CMake error: error in configuration process, project files may be invalid(Windows&VS可参考)
解决方案-CMake error: error in configuration process, project files may be invalid(Windows&VS可参考)
3431 0
废弃第三方库导致的library not found for -lXXXXX(linker command failed ) 完美解决方法
废弃第三方库导致的library not found for -lXXXXX(linker command failed ) 完美解决方法
179 0
未解决:maven:Fatal error compiling: 无效的标记: -arg
未解决:maven:Fatal error compiling: 无效的标记: -arg
150 0
解决办法:configure: error: C compiler cannot create executables错误
解决办法:configure: error: C compiler cannot create executables错误
724 0
VS2010:fatal error LNK1112:模块计算机类型 X86 与目标计算机类型 X64冲突
VS2010:fatal error LNK1112:模块计算机类型 X86 与目标计算机类型 X64冲突
187 0
编译OpenJDK8:NMAKE : fatal error U1077
编译OpenJDK8:NMAKE : fatal error U1077
173 0
warning: C4819的解决办法
warning: C4819的解决办法
154 0