Build faliure while compiling in mvn Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile | Selenium Forum
D
Devi Priya Posted on 25/07/2020

Build faliure while compiling in mvn Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile

C:\Users\priya\eclipse-workspace\datadrivenframeworkThree>mvn compile
[INFO] Scanning for projects...
[INFO]
[INFO] -------------< datadrivenFWThree:datadrivenframeworkThree >-------------
[INFO] Building datadrivenframeworkThree 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ datadrivenframeworkThree ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\priya\eclipse-workspace\datadrivenframeworkThree\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ datadrivenframeworkThree ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 1 source file to C:\Users\priya\eclipse-workspace\datadrivenframeworkThree\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.521 s
[INFO] Finished at: 2020-07-25T15:38:49+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project datadrivenframeworkThree: Compilation failure -> [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


D
Devi Priya Replied on 25/07/2020

Please ignore the above logs. PFB latest log.

Java version: jdk1.8.0_261

maven version: apache-maven-3.6.3

I have updated below also window-> prefrences->Installated JRE's -> added the JDK folder. even after after that facing below error. also attached my pom.xml file below.

[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< com.datadrivenfour:DataDrivenFour >------------------
[INFO] Building DataDrivenFour 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ DataDrivenFour ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\priya\eclipse-workspace\DataDrivenFour\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ DataDrivenFour ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 2 source files to C:\Users\priya\eclipse-workspace\DataDrivenFour\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: 0.952 s
[INFO] Finished at: 2020-07-25T16:46:15+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project DataDrivenFour: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR]
[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


S
Sarabjit Singh Bansal Replied on 26/07/2020

Hi Priya,

I think you added the JDK folder, but you also need to recompile the code again.

search your project in cmd

type : mvn compile and then mvn test. Then i think it should work.

 

Follow below steps: 

https://mkyong.com/eclipse/eclipse-ide-no-compiler-is-provided-in-this-environment-perhaps-you-are-running-on-a-jre-rather-than-a-jdk/

 

Let me know if it helps


S
Sarabjit Singh Bansal Replied on 26/07/2020

Hi Priya,

I think you added the JDK folder, but you also need to recompile the code again.

search your project in cmd

type : mvn compile and then mvn test. Then i think it should work.

 

Follow below steps: 

https://mkyong.com/eclipse/eclipse-ide-no-compiler-is-provided-in-this-environment-perhaps-you-are-running-on-a-jre-rather-than-a-jdk/

 

Let me know if it helps


A
Ashish Replied on 30/07/2020

I noticed a few things that need to be rectified as soon as possible.

1. Install JDK 8 and install it. (If Already done. move to next step)

2. Configure environment variables to use JDK only. (Need to add JDK bin path to PATH variable and JDK path to JAVA_HOME variable.)

3. Make sure your pom.xml specifies JDK 8 as the preferred environment. (Sample attached below)

  <modelVersion>4.0.0</modelVersion>

  <groupId>com.qtpselenium.hybrid</groupId>
  <artifactId>Hybrid_Framework</artifactId>
  <version>1.0-SNAPSHOT</version>

  <name>Project Name</name>

<!-- JDK 8 configuration below -->

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>

<!-- completed -->

  <dependencies>