Error executing from commandline on Windows (Exception in thread "main"
java.lang.NoClassDefFoundError:
org/codehaus/plexus/classworlds/launcher/Launcher)
----------------------------------------------------------------------------------------------------------------------------------------------------------
Key: MNG-4668
URL: http://jira.codehaus.org/browse/MNG-4668
Project: Maven 2 & 3
Issue Type: Bug
Components: Command Line
Affects Versions: 3.0-beta-1
Environment: Window XP
Reporter: Karla Jacobsen
Attachments: mvn_bat_exit_patch.txt, mvn_bat_noexit_patch.txt
I get the following error when trying to execute from the commandline:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/codehaus/plexus/classworlds/launcher/Launcher
The problem appears when a user has multiple Maven installations and has
previously set M2_HOME. If M2_HOME points to an installation other than the one
currently trying to run, and the M2_HOME installation does not have the same
classworlds jar (plexus-classworlds-*.jar versus classworlds-*.jar), the test
cases in the .bat script will succeed, but Maven will fail.
I've attached two possible patches because I wasn't sure what the preferred
behavior would be. The mvn_bat_noexit_patch.txt adds a check to make sure that
the M2_HOME directory matches up with the script's parent directory. If the
directories do not match, it prints a warning message and continued executing.
This assumes that either there are cases in which we may want to allow the
batch script's directory and M2_HOME to differ, or we just want to give someone
a helpful message if the difference breaks things.
The second patch, mvn_bat_exit_patch.txt adds the same check and exits with an
error message if the directories don't match. I think this is the better
approach. It cuts down on the possibility of subtle errors down the road.
The same changes will probably need to be made to the mvnDebug.bat.
I did not check whether any of the other scripts need to be updated.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira