Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

maven project error

Posted on 2016-11-20
5
Medium Priority
?
146 Views
Last Modified: 2016-11-20
Hi,
I am trying maven simple java example of Calculator which adds couple of numbers on new windows laptop with eclipse Luna on it.

I right clicked on Calculator project and Run As Maven Clean that cleaned well. When again right clicked and Run As maven install getting below error.

[INFO] Scanning for projects...
[INFO]                                                                        
[INFO] ------------------------------------------------------------------------
[INFO] Building calculator 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom
[INFO] Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom (7 KB at 9.0 KB/sec)
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ calculator ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\gpEclipse_workspace\calculator\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ calculator ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 4 source files to C:\Users\gpEclipse_workspace\calculator\target\classes
[INFO] -------------------------------------------------------------
COMPILATION ERROR :
[INFO] -------------------------------------------------------------
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: 3.149 s
[INFO] Finished at: 2016-11-20T19:43:12-05:00
[INFO] Final Memory: 10M/133M
[INFO] ------------------------------------------------------------------------
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project calculator: Compilation failure
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
-> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException



I wonder why i get this error. and how to resolve this
I checked eclipse window-->preferences--java--compiler--jdk compliance set to comiler compliance level to 1.8 in disabled drop down box

please advise
0
Comment
Question by:gudii9
  • 2
  • 2
5 Comments
 
LVL 7

Author Comment

by:gudii9
ID: 41895199
window-->preferences--java--compiler-
installed JRE has JRE1.8 though
0
 
LVL 7

Accepted Solution

by:
micropc1 earned 1000 total points
ID: 41895201
You need to use the JDK - not the JRE. Download the JDK and add the JDK libraries to your project in the configuration.
0
 
LVL 36

Assisted Solution

by:mccarl
mccarl earned 1000 total points
ID: 41895203
So the error message should be pretty obvious then...      
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
0
 
LVL 7

Author Comment

by:gudii9
ID: 41895205
when i swirched to JDK1.8 under "Installed JRE" it worked.

Is it not misnomer to give JDK under eclipse "Installed JRE" (as the name says Installed JRE and we are changing default JRE 1.8 to JDK 1.8)

Also why Run As Maven Compile is happy with JRE 1.8
where as
Run As Maven Install is not happy about JRE 1.8 but only happy with JDK1.8??
0
 
LVL 36

Expert Comment

by:mccarl
ID: 41895207
Is it not misnomer to give JDK under eclipse "Installed JRE"

Take it up with Eclipse developers, I guess.

Also why Run As Maven Compile is happy with JRE 1.8
where as
Run As Maven Install is not happy about JRE 1.8 but only happy with JDK1.8??

I assume you meant to type "Clean" not "Compile"... anyway. "Maven clean" only deletes files where as "Maven install" has to compile the class from source files hence it needs the java compiler (javac.exe) that comes with JDK
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
A solution for Fortify Path Manipulation.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses

782 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question