私のMavenプロジェクトは、Eclipse上のJavaSE-1.8であるコンパイラを認識していません。コンパイラは、Eclipse のどこからでも正常に動作しています。
私が取得し続けるエラーは次のとおりです。
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project DNM: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
私の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>AxyMVN</groupId>
<artifactId>DNM</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>DNM</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
プロジェクトのコンパイラの構成は問題ないようです:
[プロジェクト エクスプローラー] ウィンドウで
JRE System Library
、プロジェクトが に設定されていることを示しますJavaSE-1.8
。プロジェクトの
Java Compiler
プロパティは に設定されていUse compliance from execution environment 'JavaSE-1.8' on the Java Build Path
ます。で
Run Configurations
開くプロジェクトのウィンドウでRight-click > Run as > Run configurations
、JRE
タブは に設定されていることを示していますWorkspace default JRE (jre1.8.0_20)
。
<properties>
以下をタグに追加してpom.xml
も何も変わりませんでした。
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
Maven > Update Project
構成を試すたびにスキップしませんでした。
プロジェクトは他のどこにも他のエラーを表示していません。
私は何が欠けていますか?
注:他の議論の中で1.7に変更したにもかかわらず、Mavenの「ビルドパスは実行環境J2SE-1.5を指定します」を見ました。