[SOLVED] Sigh, just had to Project > Clean > Build. Using Run As > Maven build... was not having it.
I'm trying to use JavaPoet to build an enum based off annotations I've created, but I'm having trouble adding the Maven dependency. I resolve log4j2, H2, and Reflections dependencies successfully, but cannot resolve JavaPoet.
I'm having trouble finding any answers on what this FATAL ERROR is, any help is appreciated. I'm using Eclipse Neon.3, I don't have much RAM on my laptop -- only 4GB. Here is my Maven build output:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building My Project 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # MainClass ---
[INFO] Deleting C:\dev\git\MainClass\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # MainClass---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) # MainClass
[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 90 source files to C:\dev\git\MainClass\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.252 s
[INFO] Finished at: 2017-07-08T09:54:56-04:00
[INFO] Final Memory: 15M/169M
[INFO] ------------------------------------------------------------------------
FATAL ERROR in native method: JDWP on getting class status, jvmtiError=JVMTI_ERROR_WRONG_PHASE(112)
JDWP exit error JVMTI_ERROR_WRONG_PHASE(112): on getting class status [util.c:1285]
I was also getting the same error in Eclipse IDE whenever I do the run maven goal clean install.
Build was successful but then displays below error.
JDWP exit error JVMTI_ERROR_WRONG_PHASE(112): on getting class status [util.c:1285]
But was surprised to see that the same maven goal was running perfectly outside eclipse in a command prompt.
To analyse further, in eclipse I opened the terminal window and ran below commands to know java compiler/vm versions
javac -version
java -version
and found that both was pointing to slight different versions.
Adding following lines in eclipse.ini file solved the issue.
-vm
C:\Program Files\Java\jdk1.8.0_91\bin\javaw.exe
Make sure you have add the above lines separately and above the following line
--launcher.appendVmargs
-vmargs
Refer this link for Setting the correct PATH for Eclipse and now
C:\Users\tarun.kumar2>java -version
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b15, mixed mode)
C:\Users\tarun.kumar2>javac -version
javac 1.8.0_91
I hope this helps you.
Related
I am using Maven for a new Java project. After generating the project using one of the Maven artifacts, I've tried to generate Maven wrapper scripts inside the project. For this purpose I am using the new Maven plugin and goal wrapper:wrapper, however I am getting the following error:
wrapperVersion not supported for Maven 3.8.1, it must be at least 4
mvn wrapper:wrapper ⇣82.8 KiB/s ⇡2.76 KiB/s 192.168.2.110 77.29.199.151 100% ─╯
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------------< com.angel:demo >---------------------------
[INFO] Building demo 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-wrapper-plugin:3.0.2:wrapper (default-cli) # demo ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.897 s
[INFO] Finished at: 2021-05-27T16:14:23+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-wrapper-plugin:3.0.2:wrapper (default-cli) on project demo: wrapperVersion not supported for Maven 3.8.1, it must be at least 4. -> [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
Java Version:
openjdk 11.0.11 2021-04-20 OpenJDK Runtime Environment (build
11.0.11+9) OpenJDK 64-Bit Server VM (build 11.0.11+9, mixed mode)
Maven version:
Apache Maven 3.8.1 (NON-CANONICAL_2021-04-26T21:52:54Z_root) Maven
home: /opt/maven Java version: 11.0.11, vendor: Oracle Corporation,
runtime: /usr/lib/jvm/java-11-openjdk Default locale: en_US, platform
encoding: UTF-8 OS name: "linux", version: "5.12.4-arch1-2", arch:
"amd64", family: "unix"
OS version: Arch Linux
Maven should contain the wrapper script starting from Maven 3.7, which shouldn't be a problem because I am using Maven 3.8, but the error message for version 4 is confusing for me and I have no idea where to look for answers.
Sometimes the answer is in front of us, but tired eyes can make us blind :D
As #JFabianMeier said, there is no Maven 3.7 and Maven wrapper scripts are included starting from Maven 4.0
https://maven.apache.org/plugins/maven-wrapper-plugin/
For your project you can still use Takari Maven Wrapper plugin. It is needed for any project with Maven version before 4.0.0.
Getting below error while mvn clean package.I am compiling this on command line.
>mvn -f myapp/pom.xml clean package
This is my command and bellow is the error. can someone please help me with this
[INFO] Compiling 1 source file to C:\VaibhavNandkule\myapp\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.170 s
[INFO] Finished at: 2020-01-24T19:20:14+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project myapp: 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
so i had the same issue and was finally able to resolve it. The problem was my ~/.mavenrc file was pointing to the wrong java path.I had defined my java_home to JAVA_HOME=/usr/libexec/java_home -v 1.8
Type the command : /usr/libexec/java_home -V.
It would show something like this
Matching Java Virtual Machines (2):
1.8.261.12 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
1.8.0_261 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home
Now the problem was defining /usr/libexec/java_home -V as the java path it was picking up this /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home rather than /Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home .
Changing the path to /Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home in mavenrc(or in your case where ever you have defined the java path) fixed this issue
For Mac, Update the "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home" in bash_profile.
Execute the following command :
vi ~/.bash_profile
Update the JAVA_HOME
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Home
. ~/.bash_profile
While setting the absolute path of the JDK in pom.xml works, this is not a portable way to set java. Your colleagues wont appreciate when you'll commit and push that pom.xml.
For Maven, you have to make sure that JAVA_HOME points to the root of the JDK.
set JAVA_HOME="C:\Program Files\Java\jdk1.8.0_171"
Since your on Windows you may as well set this in the standard Environment Variables panel.
You can verify your configuration by running mvn -version:
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: C:\tools\apache-maven-3.6.3\bin\..
Java version: 1.8.0_232, vendor: Amazon.com Inc., runtime: C:\tools\java\jdk1.8.0_232\jre
Default locale: fr_CA, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
Finally, It worked for me. I have to add the below code in my pom.xml.
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<fork>true</fork>
<executable>C:\Program Files\Java\jdk1.8.0_171\bin\javac.exe</executable>
</configuration>
</plugin>
I have several Eclipse projects that I am building using Maven. It is basically a couple of library jars (because I have shared code), and 4 Google App Engine projects that reference them. I have setup a Windows batch file to build them all via a Maven command line in sequence as a convenience when building locally to test new code.
I am getting random build failures when running the batch file complaining it can't find a compiler. Oddly enough, if i restart the batch file it will build just fine the 2nd time. The script always fails on projects that have changes, however it isn't always the same project. I've had it happen to pretty much every project in the chain, and to both the library projects and the GAE WebApp projects as well. It's weird to me because these projects build correctly about 90% of the time. I should note I am not getting an errors building in Eclipse, however those will only build one at a time.
Here is a redacted snippet of my batch file:
#REM Change to the Maven project dir
CD "%BASE_DIR%\[redacted]"
(mvn install 2>&1 & call doskey /exename=err err=%%^^errorlevel%%) | C:\utility\wtee.exe -a "%LOG_FILE%"
FOR /f "tokens=2 delims==" %%A IN ('doskey /m:err') DO SET RETURN_CODE=%%A
ECHO maven returned %RETURN_CODE%
#IF %RETURN_CODE% gtr 0 GOTO :END
And here is the console output:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building [redacted] 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # [redacted] ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\[redacted]\git\DEVON\Code\[redacted]\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) # [redacted] ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 24 source files to C:\Users\[redacted]\git\DEVON\Code\[redacted]\target\[redacted]-0.0.1-SNAPSHOT\WEB-INF\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.139 s
[INFO] Finished at: 2016-06-28T14:15:45-07:00
[INFO] Final Memory: 13M/304M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project [redacted]: 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
maven returned 1
I have searched and searched here and using Google, but all the suggestions point to an incorrect JDK setup in the project or to Java compiler pathing issues. However I have checked all of that, and of course the project DOES build right almost all the time, and of course if I simply restart the batch file it works fine.
For reference:
Using Eclipse 4.5.2 (Mars)
Using Maven 3.3.9
Using JDK 1.7.0.80
All projects are set to "Compiler compliance level" 1.7 (because of GAE)
Java build path references:
Google App Engine 1.9.37
JavaSE-1.7
Has anyone seen something like this before? This is an annoyance more than a blocker, however any help to resolving it would be appreciated.
EDIT:
After adding the -V switch, I noticed that Maven was referencing a jre in the log:
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T09:41:47-07:00)
Maven home: C:\Utility\apache-maven-3.3.9\bin\..
Java version: 1.8.0_92, vendor: Oracle Corporation
Java home: c:\Program Files\java\jre1.8.0_92\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"
[INFO] Scanning for projects...
Again the weird thing is this compiles fine like 95% of the time, so it much use the JDK most of the time or it would not compile at all...
I've tried changing my java home environment variable to c:\Program Files\java\jdk1.8.0_92 in the batch file to see if that resolves it.
I'm going to guess that somehow your path for Java is not consistent when executing the script. Try running maven with the -v flag. This will cause it to tell you which Java home and version it is running. Your java home should be a jdk installation, and not a jre installation.
I am trying to compile a spring boot project with mvn package command but I am getting this error. I believe I have the JDK 1.7_55 installed.
[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.144s
[INFO] Finished at: Fri May 16 11:57:18 EST 2014
[INFO] Final Memory: 8M/154M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project m
yproject: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
Here is the output of the javac.
testspring>javac -version
javac 1.7.0_55
And here is the output of maven version.
..\testspring>mvn -v
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-20 00:51:28+1100)
Maven home: C:\Program Files\Apache Software Foundation\apache-maven-3.0.5\bin\..
Java version: 1.7.0_55, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jre7
Default locale: en_AU, platform encoding: Cp1252
OS name: "windows 8.1", version: "6.3", arch: "amd64", family: "windows"
try the following
Go to
Windows -> Preferences -> Java -> Installed JREs
And check whether it is pointing to your JDK path, if not, click on edit button and put the path you configured your JAVA_HOME enviroment.
And
Go to
Window > Preferences > Java > Installed JREs > Execution Environments
Select JavaSE-1.6 or your required version , click the jdk checkbox on the right.
Then right click on your project in eclipse and select Mavan -> “update project configuration”
Try setting your JAVA_HOME to the location where you have your JDK installed, for example:
export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Or with newer JDK:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/
I got the issue because my java is referred to JRE rather than JDk.
I was using spring tool suite.
go to windows->preferences->Java->installedJre's and verify if it's pointed to JRE or JDK
Right click on your project-> goto properties ->Select java build path
-> switch to Libraries -> there you have to change jre to jdk
I think this will solve your problem.
I'm trying to use play-scalr with Play, and have followed the install instructions on the Github page, however when I make a request for a resized image I get the error:
[RuntimeException: java.lang.UnsupportedClassVersionError: se/digiplant/scalr/api/Resizer$Mode : Unsupported major.minor version 51.0]
When I compiled the project, jars were downloaded, so I assume that the issue is that they were compiled using Java 1.7, but I'm trying to use them with Java 1.6:
$ play compile
[info] Loading project definition from /Users/brad/projects/builders/project
[info] Set current project to builders (in build file:/Users/brad/projects/builders/)
[info] Updating {file:/Users/brad/projects/builders/}builders...
[info] downloading http://repo1.maven.org/maven2/se/digiplant/play-scalr_2.10/1.0/play-scalr_2.10-1.0.jar ...
[info] [SUCCESSFUL ] se.digiplant#play-scalr_2.10;1.0!play-scalr_2.10.jar (2782ms)
[info] downloading http://repo1.maven.org/maven2/se/digiplant/play-res_2.10/1.0/play-res_2.10-1.0.jar ...
[info] [SUCCESSFUL ] se.digiplant#play-res_2.10;1.0!play-res_2.10.jar (2553ms)
[info] Done updating.
[success] Total time: 26 s, completed 14/04/2013 3:06:18 PM
Here's the versions of what I'm using:
$ play about
[info] Loading project definition from /Users/brad/projects/builders/project
[info] Set current project to builders (in build file:/Users/brad/projects/builders/)
[info] This is sbt 0.12.2
[info] The current project is {file:/Users/brad/projects/builders/}builders
[info] The current project is built against Scala 2.10.0
[info] Available Plugins: play.Project, sbt.PlayProject, com.typesafe.sbteclipse.plugin.EclipsePlugin, com.typesafe.sbtidea.SbtIdeaPlugin
[info] sbt, sbt plugins, and build definitions are using Scala 2.9.2
$ scala -version
Scala code runner version 2.9.2 -- Copyright 2002-2011, LAMP/EPFL
$ java -version
java version "1.6.0_43"
Java(TM) SE Runtime Environment (build 1.6.0_43-b01-447-11M4203)
Java HotSpot(TM) 64-Bit Server VM (build 20.14-b01-447, mixed mode)
$ javac -version
javac 1.6.0_43
I ended up downloading the source for play-scalr, compiling with Java 1.6 and then putting the resulting .jar into my lib/ directory.