@Override public void addPlugin(MavenPlugin plugin) { MavenCoreFacet mavenCoreFacet = project.getFacet(MavenCoreFacet.class); Model pom = mavenCoreFacet.getPOM(); pom.getBuild().addPlugin(new MavenPluginAdapter(plugin)); mavenCoreFacet.setPOM(pom); }
@Override public void removePlugin(Dependency dependency) { MavenCoreFacet mavenCoreFacet = project.getFacet(MavenCoreFacet.class); List<Plugin> pomPlugins = mavenCoreFacet.getPOM().getBuild().getPlugins(); for (Plugin pomPlugin : pomPlugins) { if (pomPlugin.getGroupId().equals(dependency.getGroupId()) && pomPlugin.getArtifactId().equals(dependency.getArtifactId())) { Model pom = mavenCoreFacet.getPOM(); pom.getBuild().removePlugin(pomPlugin); mavenCoreFacet.setPOM(pom); } } }
@Override public List<MavenPlugin> listConfiguredPlugins() { MavenCoreFacet mavenCoreFacet = project.getFacet(MavenCoreFacet.class); List<Plugin> pomPlugins = mavenCoreFacet.getPOM().getBuild().getPlugins(); List<MavenPlugin> plugins = new ArrayList<MavenPlugin>(); for (Plugin plugin : pomPlugins) { MavenPluginAdapter adapter = new MavenPluginAdapter(plugin); MavenPluginBuilder pluginBuilder = MavenPluginBuilder.create() .setDependency( DependencyBuilder.create() .setGroupId(plugin.getGroupId()) .setArtifactId(plugin.getArtifactId()) .setVersion(plugin.getVersion())) .setConfiguration(adapter.getConfig()); plugins.add(pluginBuilder); } return plugins; }