如何解决 "编译失败。对于输入的字符串:"/1.8" -> [帮助1]"。"\1.8" -> [帮助1]"在IntelliJ IDEA中。

问题描述 投票:1回答:1

我下载了IntelliJ IDEA,并尝试编写一个插件。然而,当我试图编译代码时,构建失败,并弹出了错误信息。

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:testCompile (default-testCompile) on project RandomTP: Execution default-testCompile of goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:testCompile failed: For input string: "\1.8" -> [Help 1]

我以前没见过这条信息 由于在谷歌上找不到类似的问题 我决定在这里问一下

问题源于当我收到

Fatal error compiling: invalid target release: 1.8

错误。我按照 这个问题 并遵循公认的答案 这个问题. 我把Project Structures下的Project SDK改为12(java版本为 "12.0.1")。在Maven Runner下,我把JRE改为Use Internal JRE。但我一重新编译,就遇到了上面的输入字符串错误。

这是IntelliJ的原始输出。

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:testCompile (default-testCompile) on project RandomTP: Execution default-testCompile of goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:testCompile failed: For input string: "\1.8" -> [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/PluginExecutionException

Process finished with exit code 1

有什么办法吗?

java intellij-idea intellij-plugin java-12
1个回答
0
投票

是的,只要添加条目 <release>8</release> 到maven插件。

...
</plugin>
    <groupId>...
    <artifactId>maven-compiler-plugin</artifactId>
    <version>...
    <configuration>
    ...
        <release>8</release>
    ...
    </configuration>
</plugin>
...
© www.soinside.com 2019 - 2024. All rights reserved.