Пример #1
0
 @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);
 }
Пример #2
0
 @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);
     }
   }
 }
Пример #3
0
  @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;
  }