0

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
Anirudh Jadhav
  • 927
  • 1
  • 9
  • 21
  • Possible duplicate: http://stackoverflow.com/questions/11118237/maven-error-could-not-find-or-load-main-class-org-codehaus-plexus-classworlds-l – Joachim Rohde May 29 '15 at 07:32
  • Don't install Maven 2 anymore http://maven.apache.org/maven-2.x-eol.html Download maven from http://maven.apache.org/download.html – khmarbaise May 29 '15 at 07:34

2 Answers2

1

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

pramesh
  • 1,774
  • 1
  • 14
  • 27
1

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

Bacteria
  • 8,138
  • 10
  • 49
  • 66
  • M2_HOME is not neccessary. Only the bin folder of the appropriate maven installation (something/apache-maven-3.0.5/bin) must be in the path. – khmarbaise May 29 '15 at 07:35