Running mvn -v returns this error only in git bash:
Error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher
In windows cmd:
C:\Users\ross>mvn -v
Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-04T12:00:29-07:00)
Maven home: C:\Program Files\apache-maven-3.6.1\bin\..
Java version: 1.8.0_221, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_221\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
In git bash:
$ echo $PATH
... :/c/Program Files/Java/jdk1.8.0_221/bin: ... :/c/Program Files/apache-maven-3.6.1/bin: ...
$ echo $JAVA_HOME
C:\Program Files\Java\jdk1.8.0_221
$ which mvn
/c/Program Files/apache-maven-3.6.1/bin/mvn
Reinstalling git bash didn't fix it
Redownloading maven didn't work either
M2_HOME, M3_HOME, MAVEN_HOME is unset
Try moving the MAVEN_HOME variable up in your environment variables
Related
When I try to execute the command
mvn clean javadoc:jar package
it shows
the JAVA_HOME environment variable is not defined correctly. This environment variable is needed to run this program.
NB: JAVA_HOME should point to a JDK, not a JRE.
I checked out the already asked question Unable to find javadoc command - maven and the solution I tried above were taken from this solution only. I am new to Ubuntu. How can I fix this?
Whereas when I run echo $JAVA_HOME it prints:
/usr/lib/jvm/java-11-openjdk-amd64
I also tried setting the JAVA_HOME to:
/etc/launchd.conf/java-11-openjdk-amd64
/usr/libexec/java-11-openjdk-amd64
/usr/libexec/java-11-openjdk-amd64/
When I run mvn -v, it prints:
Apache Maven 3.6.3
Maven home: /usr/share/maven
Java version: 11.0.10, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux", version: "5.8.0-45-generic", arch: "amd64", family: "unix"
And when I run echo $JAVA_HOME it prints:
/usr/lib/jvm/java-11-openjdk-amd64
Hmm..., probably the file doesn’t exist for running javadoc. Does the file /usr/lib/jvm/java-11-openjdk-amd64/bin/javadoc exist?
Please try:
sudo apt install openjdk-11-jdk
I would remove the above listed packages with pattern openjdk-11-.* (see this question) and install Java like this.
On my Mac (big Sur) I was getting the same problem. After reading this article ; this command worked for my enviroment:
export JAVA_HOME=$(/usr/libexec/java_home)
I have recently started working on MacOS, I installed Maven and when i checked out for it's Maven Home Path,I found out a strange path and I need to change this path.
When I run mvn -v command in terminal,i am get this output
Maven home: /usr/local/Cellar/maven/3.6.3_1/libexec
Java version: 15.0.1, vendor: N/A, runtime:
/usr/local/Cellar/openjdk/15.0.1/libexec/openjdk.jdk/Contents/Home
Default locale: en_GB, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.7", arch: "x86_64", family: "mac"
Kindly help me changing the Maven path to a different version that I desire.
binary home, using set o export and the path to maven root directory...
repository,
I'm seeing some discrepancies between commands I execute on my plain old OS terminal (I'm using a Mac) and the terminal that ships with IntelliJ (the version I'm using is Ultimate 2019.2).
For one thing, Maven isn't recognized in IntelliJ, even though I've set the Maven home directory correctly in the IntelliJ settings to /opt/apache-maven-3.6.0 instead of the bundle that ships with IntelliJ. I've also ensured that the JDK in IntelliJ is set to /Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home/bin/java.
OS terminal:
$ which java
/Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home/bin/java
$ which mvn
/opt/apache-maven-3.6.0/bin/mvn
$ mvn -v
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T13:41:47-05:00)
Maven home: /opt/apache-maven-3.6.0
Java version: 1.8.0_211, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.13.6", arch: "x86_64", family: "mac"
IntelliJ terminal:
$ which java
/usr/bin/java
$ mvn -v
bash: mvn: command not found
Can someone explain these discrepancies?
I solved this issue using a suggestion from this post (the third suggestion from #Kyle Strand). In the terminal settings in IntelliJ, I set the shell path for Bash to run in interactive mode using -i. I'm now using the same $PATH as my OS terminal and Maven command line is now recognized.
I fail to build guava v21.0 as the test concurrent.ListenerCallQueueTest hangs for ever:
$ git clone https://github.com/google/guava
$ cd guava
$ git tag
$ git checkout v21.0
$ mvn package
[...]
Tests run: 11, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.177 sec
Running com.google.common.util.concurrent.ListenerCallQueueTest
It seems I have three sleeping processes:
$ ps aux | grep guava | grep -v grep
john 23619 16.6 12.5 4531216 1016192 pts/1 Sl+ 07:47 4:43 /usr/lib/jvm/java-8-openjdk-amd64/bin/java -classpath /usr/share/maven/boot/plexus-classworlds-2.x.jar -Dclassworlds.conf=/usr/share/maven/bin/m2.conf -Dmaven.home=/usr/share/maven -Dmaven.multiModuleProjectDirectory=/home/john/Libs/guava org.codehaus.plexus.classworlds.launcher.Launcher clean install
john 26401 0.0 0.0 4292 756 pts/1 S+ 07:55 0:00 /bin/sh -c cd /home/john/Libs/guava/guava-tests && /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -Xmx1536M -Duser.language=hi -Duser.country=IN -jar /home/john/Libs/guava/guava-tests/target/surefire/surefirebooter6901955962891879666.jar /home/john/Libs/guava/guava-tests/target/surefire/surefire4499145904440222523tmp /home/john/Libs/guava/guava-tests/target/surefire/surefire2603198880854108081tmp
john 26403 68.8 14.4 4137984 1167932 pts/1 Sl+ 07:55 14:07 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -Xmx1536M -Duser.language=hi -Duser.country=IN -jar /home/john/Libs/guava/guava-tests/target/surefire/surefirebooter6901955962891879666.jar /home/john/Libs/guava/guava-tests/target/surefire/surefire4499145904440222523tmp /home/john/Libs/guava/guava-tests/target/surefire/surefire2603198880854108081tmp
This situation occurs on my debian stretch machine:
$ uname -a
Linux front 4.8.0-1-amd64 #1 SMP Debian 4.8.5-1 (2016-10-28) x86_64 GNU/Linux
$ mvn -version
Apache Maven 3.3.9
Maven home: /usr/share/maven
Java version: 1.8.0_121, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_GB, platform encoding: UTF-8
OS name: "linux", version: "4.8.0-1-amd64", arch: "amd64", family: "unix"
The same procedure leads to a successful build on my debian jessie machine:
Apache Maven 3.0.5
Maven home: /usr/share/maven
Java version: 1.8.0_111, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_GB, platform encoding: UTF-8
OS name: "linux", version: "3.16.0-4-amd64", arch: "amd64", family: "unix"
Following suggestions found in this post I have achieved a successful build with:
$ mvn clean install -Dmaven.test.skip
However running mvn clean install instead of mvn clean package leads to the same result.
Any suggestion is greatly appreciated.
I am trying to package a java project using maven. I've done it before on my old computer, but I can't seem to make it work on my new computer.
Here is the error:
`
(env)kyle#thinkpad ~/Code/simplefilehosting $ mvn -version
Apache Maven 3.0.5
Maven home: /usr/share/maven
Java version: 1.7.0_95, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.16.0-38-generic", arch: "amd64", family: "unix"
(env)kyle#thinkpad ~/Code/simplefilehosting $ java -version
java version "1.7.0_95"
OpenJDK Runtime Environment (IcedTea 2.6.4) (7u95-2.6.4-0ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)
(env)kyle#thinkpad ~/Code/simplefilehosting $ javac -version
javac 1.7.0_95
(env)kyle#thinkpad ~/Code/simplefilehosting $
Here is my version information for java, javac and mvn:
(env)kyle#thinkpad ~/Code/simplefilehosting $ mvn -version
Apache Maven 3.0.5
Maven home: /usr/share/maven
Java version: 1.7.0_95, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.16.0-38-generic", arch: "amd64", family: "unix"
(env)kyle#thinkpad ~/Code/simplefilehosting $ java -version
java version "1.7.0_95"
OpenJDK Runtime Environment (IcedTea 2.6.4) (7u95-2.6.4-0ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)
(env)kyle#thinkpad ~/Code/simplefilehosting $ javac -version
javac 1.7.0_95
(env)kyle#thinkpad ~/Code/simplefilehosting $
I tried looking at it online and add a plugin but then my mvn never realized the plugins tag or anything else. And I haven't changed the pom.xml from the last time I was able to package it.
Without the actual error message to diagnose (I think you intended to include it but didn't)...but a few things:
-check your M2_HOME and JAVA_HOME variables and make sure they are correct
-make sure settings.xml is in your ~/.m2 or $M2_HOME/config directories
-on your old machine, delete your entire ~/.m2/repository directory and see if it builds, if you upgraded Maven along the way there might be something you already have that Maven3 can't for some reason download
-consider upgrading, 3.0.5 was an intermediate version that was between the old Maven2 and Maven3 artifact resolution, some major differences, some completely different behavior, who knows what you have.