I have set up a new Cloud 9 project and am trying to run my Google App Engine (Java) project. I set the project up as a custom template. I type the following command into the terminal to build my project.
marcmouallem#my-project:~/workspace (master) $ mvn appengine:devserver
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error resolving version for 'com.google.appengine:appengine-maven-plugin': Plugin requires Maven version 3.0
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Thu Jan 15 22:08:53 UTC 2015
[INFO] Final Memory: 10M/907M
[INFO] ------------------------------------------------------------------------
Mainly concerned with the part that says ...
Plugin requires Maven version 3.0
Looking at the version I get ...
marcmouallem#my-project:~/workspace (master) $ mvn --version
Apache Maven 2.2.1 (rdebian-14)
Java version: 1.7.0_65
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en, platform encoding: UTF-8
OS name: "linux" version: "3.14.13-c9" arch: "amd64" Family: "unix"
marcmouallem#my-project:~/workspace (master) $
Is there anyway I can get Cloud 9 to use Maven 3?
Cloud9 workspaces are Ubuntu Docker containers so you can install Maven 3 the standard way (making sure to remove Maven 2 as well).
Checkout the manual installation if your current ubuntu can not install maven via common 'apt-get install maven'.
sudo apt-get update
sudo apt-get install maven
Make sure to remove maven 2 if your ubuntu is not fresh or if you were using maven 2 before:
sudo apt-get remove maven2
Update: Cloud9 now provides Google Cloud Platform workspaces that come with Maven, gcloud tools, and Google Cloud deployment built-in. This may not be perfect for you but could offer you an environment where Maven is already setup for you.
Source: Google Cloud Platform on Cloud9
Related
I am trying to build locally this repository https://github.com/spring-projects/spring-petclinic
I followed the steps from the repo but the build result looks like this:
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.757 s
[INFO] Finished at: 2023-01-23T15:27:08+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:3.0.1:build-info (default) on project spring-petclinic: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:3.0.1:build-info failed: Unable to load the mojo 'build-info' in the plugin 'org.springframework.boot:spring-boot-maven-plugin:3.0.1' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/springframework/boot/maven/BuildInfoMojo has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0.
My Java version is:
$ java -version
openjdk version "11.0.17" 2022-10-18
OpenJDK Runtime Environment (build 11.0.17+8-post-Ubuntu-1ubuntu218.04)
OpenJDK 64-Bit Server VM (build 11.0.17+8-post-Ubuntu-1ubuntu218.04, mixed mode)
And Maven version is:
$ mvn -v
Apache Maven 3.6.0
Maven home: /usr/share/maven
Java version: 11.0.17, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "5.10.102.1-microsoft-standard-wsl2", arch: "amd64", family: "unix"
I tried to run the steps from the repo, but that didn't worked for me.
Try Java 14 or above to handle this:
Java SE 14 (or JDK 14) is the version that handles class files with a version number of 61.0
class file version 61.0 = Java 17. If you are trying to run the project via your IDE, it will be using an independant java version from what's configured for your terminal's classpath.
The tutorial mentiones Intellij, so I'll assume that's what you're using. Go into File -> Project Structure and you will have your SDK and Language Level in there for that project, make sure they're the correct versions.
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.
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'm building a project using maven (at which I am a novice) and it's hanging:
$ mvn package
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Presentation Reports
[INFO] task-segment: [package]
[INFO] ------------------------------------------------------------------------
[INFO] artifact org.codehaus.mojo:tomcat-maven-plugin: checking for updates from central
This command has been doing the job without issue for a while, I didn't [knowingly?] change anything and it has begun hanging at that point (even left it overnight and it didn't budge).
$ mvn --version
Apache Maven 2.2.1 (rdebian-8)
Java version: 1.7.0_25
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "3.5.0-23-generic" arch: "amd64" Family: "unix"
I'll be honest, I'd be hugely impressed if anyone pinpointed the problem with just this information but any pointers in the right direction would be hugely helpful, searching around yielded nothing and I'm not sure where to start.
looks like it hangs while downloading, to see the exact point where it hangs please run
mvn clean package -X -e
that will give you debug level logging detail
from the comments it needed a restart of artifactory process
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.