versionToInstall = promptVersion(deps, pluginCoordinates, null).getVersion();
}
}
// Install the plugin
MavenPluginAdapter pluginToInstall = new MavenPluginAdapter(mergeWithExisting ? mergedPlugin : filteredPlugin);
pluginToInstall.setVersion(versionToInstall);
if (!managed)
{
// In case of a direct plugin install
// We want it's version being managed in the plugin management section
MavenPluginAdapter mavenManagedPlugin = null;
if (managedPlugin != null)
{
// A plugin managemement section already exists, update version
mavenManagedPlugin = new MavenPluginAdapter(managedPlugin);
mavenManagedPlugin.setVersion(pluginToInstall.getVersion());
}
else
{
// Create a new plugin management, that will handle the minimal configuration: groupId, artifactId and
// version
Plugin newManagedPlugin = new Plugin();
newManagedPlugin.setGroupId(pluginToInstall.getGroupId());
newManagedPlugin.setArtifactId(pluginToInstall.getArtifactId());
newManagedPlugin.setVersion(pluginToInstall.getVersion());
mavenManagedPlugin = new MavenPluginAdapter(newManagedPlugin);
}
// Install the plugin management, if needed
addOrUpdatePlugin(deps, plugins, mavenManagedPlugin, true);
pluginToInstall.setVersion(null); // handled by the plugin management section