Maven not getting installed - maven

I have installed maven in RedHat
by curl http://www.jpackage.org/jpackage50.repo > /etc/yum.repos.d/jpackage.repo
yum install maven2
and when i hit
mvn --version
getting this error
Error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher

I came across similar problem and after adding below environment variables it worked for me
export M2_HOME=<your apache-maven installation path up to bin>
export JAVA_HOME=<your Java installation path up to bin>
Also modify your PATH variable

Instead of doing that you can copy maven source and point M2_HOME to that location.

Related

Maven version error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher

I've installed maven and configured it correctly. I downloaded the bin file. I set my JAVA_HOME and MAVEN_HOME and put them in my path. But when I put mvn -version in the command window I get this error:
Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher
I've searched and searched. I tried putting M3_HOME, M2_HOME, M2E_HOME, nothing works!

Error: Could not find or load main class org.apache.tools.ant.launch.Launcher osx jenkins slave

I have tried to build on jenkins slave with osx on it and got this error. When I log into machine, I can run ant -version and it works. Only when I try to build from jenkins this error occurs:
Error: Could not find or load main class org.apache.tools.ant.launch.Launcher
I have found that the problems lies within brew version of ant. If i have installed separate version it works. I have found that it may be caused by different dir structure. In Brew version there is a libexec dir whether in "ordinary" there is a lib dir. Maybe creating symlink to libexec with lib name it would work but i haven't checked it.

How to add Apache Maven to PATH permanently

When I add Apache Maven to PATH using
export PATH=/opt/apache-maven-3.3.9/bin:$PATH
and then check echo $PATH
I can see that bin was added to PATH. However if I repeat echo $PATH later, it disappears from PATH and mvn --version returns:
The program 'mvn' can be found in the following packages:
* maven
* maven2
How to add maven to PATH permanently?
put export PATH=/opt/apache-maven-3.3.9/bin:$PATH in ~/.bashrc

Maven:Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher

Same to this one but still didn't figure out. tried all solution....
Maven error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher
OS: Windows 7
Installed Maven 3.3.3 from ftp://mirror.reverse.net/pub/apache/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.zip
Environment variable:
Path = C:\Tools\apache-maven-3.3.3\bin
M2_HOME = C:\Tools\apache-maven-3.3.3
Error:
$ mvn
Error: Could not find or load main class
org.codehaus.plexus.classworlds.launche r.Launcher
I guess this error caused because of downloading SRC instead of BINARY from Maven site. Please make sure to download Binary zip.
I've solved the error by downloading the bin file from maven, not the src file, and then the path pointing to the bin directory
Step1: Install ApacheMaven Binary-tar.gz archive file
Step2: Add C:\Program Files\apache-maven-3.5.2\bin to the PATH under user variables
Step3: In command prompt, run mvn -v
Change M2_HOME by MAVEN_HOME. It worked for me on Windows 7.
This fixed mine, taken from
use M3 home
I had this little issue on my Mac after installing maven3 and jdk1.7. Here is what fixed my issue:
Remove the M2_HOME variable from the path.
Add M3_HOME variable with the path to your maven 3 installation.
Here is the interesting part: I use symbolic links for versioning. The values of both M2_HOME and M3_HOME were identical. Both were /Developer/maven. Hence it appears that the name M2_HOME in place of M3_HOME is what actually causes the issue. I leave it as an exercise (that I may return to) to find the issue in the source.
This means maven is not properly configured.
There is a chance that you might have downloaded wrong zip file or incomplete file.
Once you are sure the file is correct and unzipped, in windows, go to command prompt,go to bin,and try to execute the mvn.bat file. The error originates from that file.If it is executing nothing to worry.
Avoid setting MAVEN_HOME.Its not needed. Set the maven bin only in the PATH
Remove & disable the M2_HOME in the /etc/environment using the unset function as in
unset M2_HOME

Gradle not working after fresh new install on debian linux

I just installed gradle on debian using the sudo apt-get install gradle command. When i try to run gralde afterwards it throws the following stack trace :
org.gradle.api.internal.classpath.UnknownModuleException: Cannot
locate JAR for module 'ant' in distribution directory 'null'.
at org.gradle.api.internal.classpath.DefaultModuleRegistry.findExternalJar(DefaultModuleRegistry.java:242)
at org.gradle.api.internal.classpath.DefaultModuleRegistry.getExternalModule(DefaultModuleRegistry.java:101)
at org.gradle.api.internal.DefaultClassPathProvider.findClassPath(DefaultClassPathProvider.java:46)
at org.gradle.api.internal.DefaultClassPathRegistry.getClassPath(DefaultClassPathRegistry.java:34)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:43)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
at org.gradle.launcher.GradleMain.main(GradleMain.java:26)
Gradle by default gets installed into
/usr/share/gradle
I have all the jars gradle requires in my jdk, so is there any way to tell gradle to search for the libraries there and start to work ?
Try to set your GRADLE_HOME
export GRADLE_HOME=/usr/share/gradle
Is there a lib under that directory? It should have the ant jar.

Resources