You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Paul Benedict (JIRA)" <ji...@codehaus.org> on 2014/07/02 15:45:15 UTC

[jira] (MNG-4668) Error executing from commandline on Windows (Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/plexus/classworlds/launcher/Launcher)

     [ https://jira.codehaus.org/browse/MNG-4668?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Benedict updated MNG-4668:
-------------------------------

    Fix Version/s:     (was: Issues to be reviewed for 3.x)

> Error executing from commandline on Windows (Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/plexus/classworlds/launcher/Launcher)
> ----------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: MNG-4668
>                 URL: https://jira.codehaus.org/browse/MNG-4668
>             Project: Maven
>          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 was sent by Atlassian JIRA
(v6.1.6#6162)