[エラー] Eclipse が Maven プロジェクトをビルドし、コマンド ライン ウィンドウでエラーをコンパイルする場合、ソース オプション 5 はサポートされなくなりました。バージョン7以降をご利用ください。

まず次のエラーをコンパイルします

[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< edu.zut.sc.software:teach >----------------------
[INFO] Building teach 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ teach ---
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ teach ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent!
[INFO] Compiling 1 source file to D:\Java\EclipseProjects\teach\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] 不再支持源选项 5。请使用 7 或更高版本。
[ERROR] 不再支持目标选项 5。请使用 7 或更高版本。
[INFO] 2 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.445 s
[INFO] Finished at: 2020-03-02T20:42:22+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project teach: Compilation failure: Compilation failure:
[ERROR] 不再支持源选项 5。请使用 7 或更高版本。
[ERROR] 不再支持目标选项 5。请使用 7 或更高版本。
[ERROR] -> [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/MojoFailureException

分析: Maven が現在の JDK バージョンを理解できず、エラーが発生している可能性があります。

解決:

Maven プロジェクトの pom.xml ファイルの <project> タグに以下を追加します。

ステートメントは次のとおりです。 私の JDK バージョンは 13.0.2 なので、13 を入力しました。
  <properties>
  	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 	 <maven.compiler.source>13</maven.compiler.source>
 	 <maven.compiler.target>13</maven.compiler.target>
</properties>

このブログ投稿はブロガーの学習プロセスを記録するためにのみ使用されます (質問がある場合はコメントしてください)

Supongo que te gusta

Origin blog.csdn.net/qq_46043634/article/details/104620102
Recomendado
Clasificación