私はMavenプロジェクトに再構成したJavaプロジェクトを持っていました。再構成して必要な依存関係のほとんどを追加した後、mvn install
コマンドを実行するとコンソールに次のエラーが表示されます。私はthis issueに、ここに述べた解決策を試してみましたが、それは以下の目標org.apache.maven.pluginsを実行できませんでした:maven-compiler-plugin:3.5.1:プロジェクトのコンパイル(デフォルトコンパイル)
は、コンソールログです助けをdoesnt:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building FlockHydraAutomation 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ FlockHydraAutomation ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ FlockHydraAutomation ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 15 source files to C:\Maven\FlockHydra-Automation\FlockHydraAutomation\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.249 s
[INFO] Finished at: 2017-09-23T13:44:15+05:30
[INFO] Final Memory: 10M/220M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project FlockHydraAutomation: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[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
POMファイル:添付
<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>com.Flock</groupId>
<artifactId>FlockHydraAutomation</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>FlockHydraAutomation</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<sourceDirectory>flockWebclient</sourceDirectory>
<resources>
<resource>
<directory>resources</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Javaコンパイラのスクリーンショットです: Java Compiler
あなたのjavaバージョンとそこにあるjavaホームの 'mvn -version' ancチェックを見てください。 – nullpointer
まず、環境変数で設定されたJDKではなくJREを使用しています。さらに、Mavenの規約に従い、sourceDirectoryとリソースの設定などの設定を変更しないでください。 Cにそれらの部品を取り外して... – khmarbaise