i want to deploy my maven project to Google Appengine, however an error in that
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) #HospitalReservationSystem ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /home/rof/src/github.com/jessezzyy/Hospital-Reservation-System/target/HospitalReservationSystem-1.0-SNAPSHOT/WEB-INF/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.062 s [INFO] Finished at: 2018-09-26T15:17:24Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project HospitalReservationSystem: Fatal error compiling: invalid target release: 1.8 -> [Help 1]
The maven project is exactly using java8, and my java jdk is also 1.8enter image description here
ZIJIANdeMacBook-Pro:JavaVirtualMachines Jesse$ echo $JAVA_HOME/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/HomeZIJIANdeMacBook-Pro:JavaVirtualMachines Jesse$ java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
I have tried to change 1.7 instead of 1.8, but it shows error:
Execution default-cli of goal com.google.cloud.tools:appengine-maven-plugin:1.3.2:deploy failed: Non zero exit: 1 -> [Help 1]
First you have to make sure that you have Java 8 and its corresponding compiler installed.
Test that by executing the following code:
java -version
and
javac -version
and
mvn -version
They should be the same version. Sometimes the java is pointing to the right version but javac version might point to an old jdk. If this is the case, you can apply the following steps:
A:Ensure the symbolic link is pointing to the correct jdk. if not, just remove it and recreate a new one for your jdk.
Code:
cd /System/Library/Frameworks/JavaVM.framework/Versions/
rm CurrentJDK
ln -s /Library/Java/JavaVirtualMachines/<jdk version>.jdk/Contents/ CurrentJDK
B:Remove the tools.jar from the extension since it could be related to the old version:
Code:
cd /Library/Java/Extensions
-rw-r--r-- 1 root admin 15286304 Jan 14 2015 tools.jar
Remove this:
sudo rm -rf /Library/Java/Extensions
In addition, you also need to make sure you %JAVA_HOME is set to 1.8 once you install the 1.8 jdk. Keep in mind that Invalid target release refers to the jdk version.
Another solution is to fork the maven-compiler-plugin and set the full path to the correct Java compiler as below:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<verbose>true</verbose>
<fork>true</fork>
<executable>C:\Program Files\Java\jdk1.8.0_79\bin\javac</executable>
</configuration>
</plugin>
This issue has already been posted along with useful answers and possible solutions to your question: Click Here
Here is another question previously posted regarding the same issue: Click Here
Though this is pretty old post, I thought I will share my quick fix for others use:
I also had faced similar issue where pom.xml is pointing 1.8 and JAVA_HOME is also pointing to 1.8
Maven build was failing through eclipse.
To address this issue, all I had to do is change the JRE version to 1.8 in JRE tab using Alternate JRE option as shown in attached screen shot.
Related
I just did a clean install. jdk 8 (from adoptium.net) and sbt (using homebrew) on a newly imaged macbook. Somehow homebrew used java 18 anyway, and sbt doesn't work.
I followed the instructions here: https://www.scala-sbt.org/1.x/docs/Installing-sbt-on-Mac.html
Following the link on that page to adoptium.net, I found the only jdk 8 for mac os.
$ java -version
openjdk version "1.8.0_322"
OpenJDK Runtime Environment (Temurin)(build 1.8.0_322-b06)
OpenJDK 64-Bit Server VM (Temurin)(build 25.322-b06, mixed mode)
Following the instructions on the sbt page, I used homebrew...
$ brew install sbt
When I check the version, I see a problem...
$ sbt about
[info] welcome to sbt 1.6.2 (Homebrew Java 18)
[info] loading project definition from /Users/KHinson1/project
[info] set current project to khinson1 (in build file:/Users/KHinson1/)
[info] This is sbt 1.6.2
[info] The current project is ProjectRef(uri("file:/Users/KHinson1/"), "khinson1") 0.1.0-SNAPSHOT
[info] The current project is built against Scala 2.12.15
Homebrew installed it using java 18?! How do I clean this up and use the java 8 that I installed? I can't find java 18 on my laptop.
I immediately run into problems trying to compile a fat jar with sbt assembly...
java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
at java.base/java.lang.System.setSecurityManager(System.java:416)
at sbt.TrapExit$.installManager(TrapExit.scala:52)
at sbt.StandardMain$.runManaged(Main.scala:52)
at sbt.xMain.run(Main.scala:28)
at xsbt.boot.Launch$.$anonfun$run$1(Launch.scala:149)
at xsbt.boot.Launch$.withContextLoader(Launch.scala:176)
at xsbt.boot.Launch$.run(Launch.scala:149)
at xsbt.boot.Launch$.$anonfun$apply$1(Launch.scala:44)
at xsbt.boot.Launch$.launch(Launch.scala:159)
at xsbt.boot.Launch$.apply(Launch.scala:44)
at xsbt.boot.Launch$.apply(Launch.scala:21)
at xsbt.boot.Boot$.runImpl(Boot.scala:78)
at xsbt.boot.Boot$.run(Boot.scala:73)
at xsbt.boot.Boot$.main(Boot.scala:21)
at xsbt.boot.Boot.main(Boot.scala)
[error] [launcher] error during sbt launcher: java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
I know this is a java 17+ problem from questions like this...
sbt assembly cannot create jar getting java.lang.UnsupportedOperationException
I've used homebrew in the past to install sbt, but I'm honestly new to macs and don't understand how it's using java 18 when I didn't install java 18.
How do I get java 18 completely off my machine (I can't even find it) and get sbt installed with java 8 as intended?
Thanks.
edit
I've tried using jenv as outlined here: How can I install openjdk 8 and sbt on mac and have openjdk 8 (not 13) the default one?
I point it at the openjdk I installed
$ which java
/usr/bin/java
but when I try
$ jenv add /usr/bin/java
/usr/bin/java is not a valid path to java installation
(edit I've blown everything out now to try SDKMAN, but I wonder if I should have pointed to /Library/Java/JavaVirtualMachines/temurin_??? directly?)
I tried using brew install sbt#0.13 which lists jdk 8 as its dependency, but it just didn't function ("command not found"). I want a newer sbt, but I think specifying something like sbt.version=1.3.6 in build.properties would force sbt to upgrade later.
I tried "expanding the zip" as suggested on the sbt install page, but same thing ("command not found"), now matter where I expand it to or how I update the path.
edit 2
i'm open to trying sdkman, but at this point I've tried installing/uninstalling a few things, and I don't know how to get java off my machine, and I'm worried about messing it all up with too many competing attempts.
The SDKMAN recommendation by #Ivan Stanislavciuc was a great one. It's really easy how it manages java environments.
Here's my process to back out of my false starts, and get things working.
# uninstall everything
brew uninstall sbt
brew uninstall jenv
cd /Library/Java/JavaVirtualMachines
sudo rm -rf <java installation>
# install sdkman
curl -s "https://get.sdkman.io" | bash
# select java version
# (I chose temurin jdk 8 which is formerly openj9;
# can't find hotspot AdoptOpenJdk anymore, is it gone?)
sdk list java
sdk install java 8.0.322-tem
sdk default java 8.0.322-tem
# install sbt
sdk install sbt
That easy.
I used to use the hotspot adopt open jdk... but I didn't see that one available anywhere now. I see hotspot is still the recommendation on the sbt install page in the SDKMAN instructions (.hs-adpt is "hotspot adopt open jdk"?). But temurin is the openj9 I think, and it matches the adoptium.net link also on the sbt page, so for now I assume that's ok.
As far as I know, you can install specific java versions inside brew. Use brew cask install java8 (of course you'll need to have cask installed first, brew install cask).
I faced same issue which you mentioned after I changed my Mac and reinstalled sbt. Now since i did not get the exact solution executing this (sudo sbt -java-home /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home assembly ) to run assembly command.
I am using java 11, jenv, just did the brew install sbt, there is no problem on my side.
$ java --version
openjdk 11.0.11 2021-04-20
OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)
$ brew reinstall sbt
...
==> Reinstalling sbt
==> Pouring sbt--1.6.2.all.bottle.tar.gz
==> Caveats
You can use $SBT_OPTS to pass additional JVM options to sbt.
Project specific options should be placed in .sbtopts in the root of your project.
Global settings should be placed in /opt/homebrew/etc/sbtopts
Homebrew's installation does not include `sbtn`.
==> Summary
🍺 /opt/homebrew/Cellar/sbt/1.6.2: 8 files, 3.7MB
$ sbt about
[info] Updated file /Users/rui/Downloads/sbt-test/project/build.properties: set sbt.version to 1.6.2
[info] welcome to sbt 1.6.2 (AdoptOpenJDK Java 11.0.11)
[info] loading project definition from /Users/rui/Downloads/sbt-test/project
[info] set current project to sbt-test (in build file:/Users/rui/Downloads/sbt-test/)
[info] This is sbt 1.6.2
[info] The current project is ProjectRef(uri("file:/Users/rui/Downloads/sbt-test/"), "sbt-test") 0.1.0-SNAPSHOT
[info] The current project is built against Scala 2.12.15
[info] Available Plugins
[info] - sbt.ScriptedPlugin
[info] - sbt.plugins.CorePlugin
[info] - sbt.plugins.Giter8TemplatePlugin
[info] - sbt.plugins.IvyPlugin
[info] - sbt.plugins.JUnitXmlReportPlugin
[info] - sbt.plugins.JvmPlugin
[info] - sbt.plugins.MiniDependencyTreePlugin
[info] - sbt.plugins.SbtPlugin
[info] - sbt.plugins.SemanticdbPlugin
[info] sbt, sbt plugins, and build definitions are using Scala 2.12.15
I would suggest two things for troubleshooting:
checkout PATH thing
run brew doctor
This is my code in github:
https://github.com/q463746583/CS4500-Assignment2
I can run it successfully in the local,
but while I try to deploy the code on heroku,
There is the error description:
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/com/thoughtworks/qdox/qdox/2.0-M9/qdox-2.0-M9.jar (317 kB at 6.0 MB/s)
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 4 source files to /tmp/build_3c4f3b86a26f6e3ae1cbe89639f79f26/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.261 s
[INFO] Finished at: 2019-01-24T00:47:07Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project myapp: Fatal error compiling: invalid target release: 11 -> [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/MojoExecutionException
! ERROR: Failed to build app with Maven
We're sorry this build is failing! If you can't find the issue in application code,
please submit a ticket so we can help: https://help.heroku.com/
! Push rejected, failed to compile Java app.
! Push failed
TLDR:
Ensure you're using the appropriate JAVA JDK
Check that your target environment from the Maven compiler is the same as your targeted Heroku JAVA runtime.
If you're not using the default JAVA 8 JDK runtime environment create a system.properties file in your project specifying a different supported JAVA runtime enviroment as listed within Heroku's JAVA buildpack documentation.
I think this has to do with a mismatch between your targeted Java runtime environment on Heroku and your locally compiled code, generated from the Maven compiler, which you're trying to push to Heroku.
According to Heroku's documentation:
Heroku currently uses OpenJDK 8 to run your application by default. OpenJDK versions 9 and 7 are also available.
Other supported default versions are:
Java 7 - 1.7.0_181
Java 8 - 1.8.0_191
Java 9 - 9.0.4
Java 10 - 10.0.2
Java 11 - 11
So you should make sure that within your pom.xml file that your maven compiler is compiling your JAVA code to the appropriate JAVA buildpack you're targeting on Heroku. For example, below we are targeting a Java 7 runtime environment:
pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
Then you should create a system.properties file in your project if you're targeting a runtime environment other than Heroku's default JDK 1.8 runtime environment. You can do this by specifying your desired java runtime environment like such:
system.properties:
java.runtime.version=11
As per the previous answers, creating a system.properties file, making a new commit with that change and rerunning the heroku command fixed the issue for me.
Also, please be mindful about the name of your branch if you're not using main as your main branch as that would require a match such as.
git push heroku master:main
or
git push heroku develop:main
I got the same error while deploying the git project in Heroku. I just changed java.version to 8 from 11 in pom.xml and it worked for me:
<properties>
<java.version>8</java.version>
</properties>
To remove this error, simply add one extra file into your repository with the name system.application and
java.runtime.version=11
Tried all the approaches, but none worked.
SOLUTION: Remove all the references to your Java version in your pom.xml, i.e.
<properties>
<java.version>11</java.version>
</properties>
This is my code in github:
https://github.com/q463746583/CS4500-Assignment2
I can run it successfully in the local,
but while I try to deploy the code on heroku,
There is the error description:
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/com/thoughtworks/qdox/qdox/2.0-M9/qdox-2.0-M9.jar (317 kB at 6.0 MB/s)
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 4 source files to /tmp/build_3c4f3b86a26f6e3ae1cbe89639f79f26/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.261 s
[INFO] Finished at: 2019-01-24T00:47:07Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project myapp: Fatal error compiling: invalid target release: 11 -> [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/MojoExecutionException
! ERROR: Failed to build app with Maven
We're sorry this build is failing! If you can't find the issue in application code,
please submit a ticket so we can help: https://help.heroku.com/
! Push rejected, failed to compile Java app.
! Push failed
TLDR:
Ensure you're using the appropriate JAVA JDK
Check that your target environment from the Maven compiler is the same as your targeted Heroku JAVA runtime.
If you're not using the default JAVA 8 JDK runtime environment create a system.properties file in your project specifying a different supported JAVA runtime enviroment as listed within Heroku's JAVA buildpack documentation.
I think this has to do with a mismatch between your targeted Java runtime environment on Heroku and your locally compiled code, generated from the Maven compiler, which you're trying to push to Heroku.
According to Heroku's documentation:
Heroku currently uses OpenJDK 8 to run your application by default. OpenJDK versions 9 and 7 are also available.
Other supported default versions are:
Java 7 - 1.7.0_181
Java 8 - 1.8.0_191
Java 9 - 9.0.4
Java 10 - 10.0.2
Java 11 - 11
So you should make sure that within your pom.xml file that your maven compiler is compiling your JAVA code to the appropriate JAVA buildpack you're targeting on Heroku. For example, below we are targeting a Java 7 runtime environment:
pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
Then you should create a system.properties file in your project if you're targeting a runtime environment other than Heroku's default JDK 1.8 runtime environment. You can do this by specifying your desired java runtime environment like such:
system.properties:
java.runtime.version=11
As per the previous answers, creating a system.properties file, making a new commit with that change and rerunning the heroku command fixed the issue for me.
Also, please be mindful about the name of your branch if you're not using main as your main branch as that would require a match such as.
git push heroku master:main
or
git push heroku develop:main
I got the same error while deploying the git project in Heroku. I just changed java.version to 8 from 11 in pom.xml and it worked for me:
<properties>
<java.version>8</java.version>
</properties>
To remove this error, simply add one extra file into your repository with the name system.application and
java.runtime.version=11
Tried all the approaches, but none worked.
SOLUTION: Remove all the references to your Java version in your pom.xml, i.e.
<properties>
<java.version>11</java.version>
</properties>
Problem : Unable to build spring maven project using Jenkins with JDK 1.8
Description : Im using Jenkins to build my spring project managed by Maven.I have configured Java 1.7 and 1.8 in Jenkins using the JDK Installations options. when selecting Java 1.7 in the build configuration and running the build, build process is success. But when i select Java 1.8 in the build configuration and running the build, build process gets failed.
****Below is the jenkins console output****
Started by user anonymous
Building in workspace C:\Users\anonymous\.jenkins\jobs\springsecuritysampleproject1\workspace
Updating file:///C:/DevEnv/Repositories/LocalSVNServerRepo/root/springsecuritysample/trunk at revision '2016-01-13T13:35:52.488 +0530'
U src\main\java\org\springframework\security\sample\HomeController.java
At revision 21
Parsing POMs
[workspace] $ C:\DevEnv\ProgramFiles\Java\jdk1.8.0_20/bin/java -cp C:\Users\anonymous\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven31-agent-1.5.jar;C:\DevEnv\ProgramFiles\ProjectTools\Apache_Maven_3.3.3\boot\plexus-classworlds-2.5.2.jar;C:\DevEnv\ProgramFiles\ProjectTools\Apache_Maven_3.3.3/conf/logging jenkins.maven3.agent.Maven31Main C:\DevEnv\ProgramFiles\ProjectTools\Apache_Maven_3.3.3 C:\Users\anonymous\.jenkins\war\WEB-INF\lib\remoting-2.53.2.jar C:\Users\anonymous\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven31-interceptor-1.5.jar C:\Users\anonymous\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.5.jar 52876
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f C:\Users\anonymous\.jenkins\jobs\springsecuritysampleproject1\workspace\pom.xml install
Waiting for Jenkins to finish collecting data
[JENKINS] Archiving C:\Users\anonymous\.jenkins\jobs\springsecuritysampleproject1\workspace\pom.xml to org.springframework.security/sample/1.0.0-BUILD-SNAPSHOT/sample-1.0.0-BUILD-SNAPSHOT.pom
Sending e-mails to: test#test.com
channel stopped
Archiving artifacts
Sending e-mails to: test#test.com
Finished: FAILURE
*
I also ran Maven manually with Java 1.7 and no issues observerd. But
when i ran the same with Java 1.8 and redirected the output to file,
found the below error
*
INFO] Compiling 1 source file to C:\DevEnv\STSWorkspaces\springsecuritysample\target\classes
[INFO] -------------------------------------------------------------
**[ERROR] COMPILATION ERROR :**
[INFO] -------------------------------------------------------------
[ERROR] Unable to locate the Javac Compiler in:
C:\DevEnv\ProgramFiles\Java\jdk1.8.0_20\..\lib\tools.jar
Please ensure you are using JDK 1.4 or above and
not a JRE (the com.sun.tools.javac.Main class is required).
In most cases you can change the location of your Java
installation by setting the JAVA_HOME environment variable.
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.640 s
[INFO] Finished at: 2016-01-13T13:40:34+05:30
[INFO] Final Memory: 8M/487M
[INFO] ------------------------------------------------------------------------
JAVA_HOME variable is correctly pointing to the JDK 1.8 installation home directory and the bin folder is also added to the path
echo %JAVA_HOME% results in C:\DevEnv\ProgramFiles\Java\jdk1.8.0_20
When changed the JAVA_HOME variable to point to Java 1.7, build is running normally and no errors
Root Cause
when debugged, it ended up in the file JavacCompiler.java of artifact plexus-compiler-javac. The line System.getProperty( "java.home" ) in the compile process outputs differently for Java 8 and Java 7
Java 7 - C:\DevEnv\ProgramFiles\Java\jdk1.7.0_80\jre
Java 8 - C:\DevEnv\ProgramFiles\Java\jdk1.8.0_20
Worked Solution :
Re-installation of Java 8
Launch the slave through cmd but dont type "java -jar slave.jar .....", rather mention the complete path of java.exe as "C:\Program Files\Java\jdk1.8.0_121\bin\java.exe" -jar slave.jar ......
We just upgraded the project from jdk 1.6 to jdk 1.8. While building the project in my machine, i'm getting following error.
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:3.3:compile
(default-compile) on project exception: Fatal error compiling: invalid
target release: 1.8 -> [Help 1]
Here is the maven compiler plugin which is been used
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
I looked at the many post and most of them were related with not having the correct version configured for java_home. I verified all of these aspects and couldn't find any of them alarming.
Java version -
qadeersmsiphone:main pdubey$ java -version
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)
Maven Version -
qadeersmsiphone:main pdubey$ mvn -version
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 08:22:22-0700)
Maven home: /usr/share/maven
Java version: 1.8.0_51, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.8.5", arch: "x86_64", family: "mac"
and I checked that while building the project maven uses jdk 1.8
qadeersmsiphone:main pdubey$ mvn install -debug
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 08:22:22-0700)
Maven home: /usr/share/maven
Java version: 1.8.0_51, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.8.5", arch: "x86_64", family: "mac"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from /usr/share/maven/conf/settings.xml
[DEBUG] Reading user settings from /Users/pdubey/.m2/settings.xml
[DEBUG] Using local repository at /Users/pdubey/.m2/repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for /Users/pdubey/.m2/repository
[INFO] Scanning for projects...
UPDATE: I could get it working by removing the
maven-compiler-plugin in pom file (Ideally, i don't want to do this). And i also observed that even if i
remove this plugin, maven by default downloads the 3.3 version of
compiler plugin in my local repo. I'm not sure what's wrong in this
plugin although source and target appears to be correct.
Check the java and Javac version - My Java version was 1.8.0_51
$ java -version
java version "1.8.0_51"
But javac version was pointing to old jdk 1.7.0_67
$ javac -version
javac 1.7.0_67
There are couple of thing which we should try -
Ensure that symbolic link is pointing to correct jdk. If not, remove existing link and create new one for your jdk
cd /System/Library/Frameworks/JavaVM.framework/Versions/
rm CurrentJDK
ln -s /Library/Java/JavaVirtualMachines/<jdk version>.jdk/Contents/ CurrentJDK
In /Library/Java/Extension, i had a tools.jar. I believe, this was from old jdk.
cd /Library/Java/Extensions
-rw-r--r-- 1 root admin 15286304 Jan 14 2015 tools.jar
Remove this
sudo rm -rf /Library/Java/Extensions
point 2 did the trick for me :)
Sometimes this problem is related to a JAVA_HOME used by maven.
In my particular case I tried to start an install target and had an exact the subj message.
Then I just tried an mvn -version command and I realized that it uses jdk7
Then I run in a console set JAVA_HOME=C:\Java\jdk8 (my jdk path, so your own could be different)
Then typed mvn clean install test and it worked just fine at last
Good luck!
Same issue here, but I was using run configurations inside Eclipse when maven kept throwing this error. Fixed by setting the right JDK version here:
I had the same issue:
> java -version
java version "1.8.0_111"
>javac -version
javac 1.7.0.6
I checked the Path in System variables, and the jdk was not updated to jdk 8.
After I updated the path with the right jdk it worked.
In cent os we can use alternatives to switch the version.
alternatives --config javac
alternatives --config java
But MAVEN uses JAVA_HOME.
And this JAVA_HOME can be possible to a link.
Either we have to point the JAVA_HOME manually to new jdk folder, OR manually remove/delete the link and create a new same link again from above answers.
From alternatives we can get the path of jdk
First of all, it is definitely versions issue.
In my situation:
java -version showed the result
java version "1.8.0_172"
and javac -version was showing
javac 1.8.0_172
BUT: Maven uses JAVA_HOME environment variable to get your JDK version to build a project and run it's a plugin. So the way how we have to check it is
echo %JAVA_HOME%
Which in my situation was
jdk1.7.0_172
So simply change the path to the variable will solve the issue.
Hope it will save time to someone.