@@ -532,6 +532,12 @@ private Path stagingDirectoryWithoutPosixPermissions(Path pluginsDir) throws IOE
532532
533533 // checking for existing version of the plugin
534534 private void verifyPluginName (Path pluginPath , String pluginName , Path candidateDir ) throws UserException , IOException {
535+ // don't let user install plugin conflicting with module...
536+ // they might be unavoidably in maven central and are packaged up the same way)
537+ if (MODULES .contains (pluginName )) {
538+ throw new UserException (ExitCodes .USAGE , "plugin '" + pluginName + "' cannot be installed as a plugin, it is a system module" );
539+ }
540+
535541 final Path destination = pluginPath .resolve (pluginName );
536542 if (Files .exists (destination )) {
537543 final String message = String .format (
@@ -574,13 +580,6 @@ private PluginInfo loadPluginInfo(Terminal terminal, Path pluginRoot, boolean is
574580
575581 terminal .println (VERBOSE , info .toString ());
576582
577- // don't let user install plugin as a module...
578- // they might be unavoidably in maven central and are packaged up the same way)
579- if (MODULES .contains (info .getName ())) {
580- throw new UserException (ExitCodes .USAGE , "plugin '" + info .getName () +
581- "' cannot be installed like this, it is a system module" );
582- }
583-
584583 // check for jar hell before any copying
585584 jarHellCheck (info , pluginRoot , env .pluginsFile (), env .modulesFile ());
586585
0 commit comments