Skip to content

Commit

Permalink
Plugins: Fix module name conflict check for meta plugins (#29146)
Browse files Browse the repository at this point in the history
This commit moves the check for plugin names conflicting with builtin
modules to a location that also applies to meta plugins.
  • Loading branch information
rjernst authored Mar 20, 2018
1 parent e582510 commit 7112d43
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,12 @@ private Path stagingDirectoryWithoutPosixPermissions(Path pluginsDir) throws IOE

// checking for existing version of the plugin
private void verifyPluginName(Path pluginPath, String pluginName, Path candidateDir) throws UserException, IOException {
// don't let user install plugin conflicting with module...
// they might be unavoidably in maven central and are packaged up the same way)
if (MODULES.contains(pluginName)) {
throw new UserException(ExitCodes.USAGE, "plugin '" + pluginName + "' cannot be installed as a plugin, it is a system module");
}

final Path destination = pluginPath.resolve(pluginName);
if (Files.exists(destination)) {
final String message = String.format(
Expand Down Expand Up @@ -574,13 +580,6 @@ private PluginInfo loadPluginInfo(Terminal terminal, Path pluginRoot, boolean is

terminal.println(VERBOSE, info.toString());

// don't let user install plugin as a module...
// they might be unavoidably in maven central and are packaged up the same way)
if (MODULES.contains(info.getName())) {
throw new UserException(ExitCodes.USAGE, "plugin '" + info.getName() +
"' cannot be installed like this, it is a system module");
}

// check for jar hell before any copying
jarHellCheck(info, pluginRoot, env.pluginsFile(), env.modulesFile());

Expand Down

0 comments on commit 7112d43

Please sign in to comment.