Package org.jboss.forge.addon.maven.projects

Examples of org.jboss.forge.addon.maven.projects.MavenPluginFacet


   */
  protected Collection<Execution> executions;

  @Override
  public boolean install() {
    final MavenPluginFacet pluginFacet = getProject().getFacet(MavenPluginFacet.class);
    final DependencyFacet depFacet = getProject().getFacet(DependencyFacet.class);
    final VersionOracle oracle = new VersionOracle(depFacet);
    final Dependency pluginDep = DependencyBuilder.create(getPluginArtifact().toString()).setVersion(
            oracle.resolveVersion(getPluginArtifact()));
    final MavenPluginBuilder plugin;

    if (pluginFacet.hasPlugin(pluginDep.getCoordinate())) {
      plugin = MavenPluginBuilder.create(pluginFacet.getPlugin(pluginDep.getCoordinate()));
      // So that it is not duplicated when added later on
      pluginFacet.removePlugin(pluginDep.getCoordinate());
    }
    else {
      plugin = MavenPluginBuilder.create();
      plugin.setCoordinate(pluginDep.getCoordinate());
    }

    Configuration config = plugin.getConfig();
    for (final ConfigurationElement configElem : getConfigurations()) {
      mergeConfigurationElement(config, configElem);
    }

    for (final DependencyBuilder dep : getDependencies()) {
      if (dep.getCoordinate().getVersion() == null || dep.getCoordinate().getVersion().equals("")) {
        if (dep.getGroupId().equals(ArtifactVault.ERRAI_GROUP_ID))
          dep.setVersion(Property.ErraiVersion.invoke());
        else
          dep.setVersion(oracle.resolveVersion(dep.getGroupId(), dep.getCoordinate().getArtifactId()));
      }
      plugin.addPluginDependency(dep);
    }

    for (final Execution exec : getExecutions()) {
      plugin.addExecution(exec);
    }
    pluginFacet.addPlugin(plugin);

    return true;
  }
View Full Code Here


          continue outer;
      }
      return false;
    }

    final MavenPluginFacet pluginFacet = getProject().getFacet(MavenPluginFacet.class);
    final MavenPlugin mPlugin = pluginFacet.getPlugin(DependencyBuilder.create(getPluginArtifact().toString())
            .getCoordinate());

    outer: for (final Execution exec : getExecutions()) {
      for (final Execution pluginExec : mPlugin.listExecutions()) {
        // TODO check more than just id
View Full Code Here

    }
  }

  @Override
  public boolean uninstall() {
    final MavenPluginFacet pluginFacet = getProject().getFacet(MavenPluginFacet.class);
    pluginFacet.removePlugin(DependencyBuilder.create(getPluginArtifact().toString()).getCoordinate());

    return true;
  }
View Full Code Here

              .setName("outputFileNameMapping")
              .setText("@{artifactId}@-@{baseVersion}@@{dashClassifier?}@.@{extension}@")));
  }

  public static String getWarSourceDirectory(final Project project) {
    final MavenPluginFacet pluginFacet = project.getFacet(MavenPluginFacet.class);
    final CoordinateBuilder warPluginCoordinate = CoordinateBuilder.create().setGroupId(War.getGroupId())
            .setArtifactId(War.getArtifactId());

    if (pluginFacet.hasPlugin(warPluginCoordinate)) {
      final Configuration warConfig = pluginFacet.getPlugin(warPluginCoordinate).getConfig();
      if (warConfig.hasConfigurationElement(WarSourceDirectory.getValueName())) {
        return warConfig.getConfigurationElement(WarSourceDirectory.getValueName()).getText();
      }
    }
View Full Code Here

  protected Collection<Execution> executions;

  @Override
  public boolean install() {
    maybeInit();
    final MavenPluginFacet pluginFacet = getProject().getFacet(MavenPluginFacet.class);
    final VersionFacet versionFacet = getProject().getFacet(VersionFacet.class);
    final Dependency pluginDep = DependencyBuilder.create(getPluginArtifact().toString()).setVersion(
            versionFacet.resolveVersion(getPluginArtifact()));
    final MavenPluginBuilder plugin;

    if (pluginFacet.hasPlugin(pluginDep.getCoordinate())) {
      plugin = MavenPluginBuilder.create(pluginFacet.getPlugin(pluginDep.getCoordinate()));
      // So that it is not duplicated when added later on
      pluginFacet.removePlugin(pluginDep.getCoordinate());
    }
    else {
      plugin = MavenPluginBuilder.create();
      plugin.setCoordinate(pluginDep.getCoordinate());
    }

    Configuration config = plugin.getConfig();
    for (final ConfigurationElement configElem : getConfigurations()) {
      mergeConfigurationElement(config, configElem);
    }

    for (final DependencyBuilder dep : getDependencies()) {
      if (dep.getCoordinate().getVersion() == null || dep.getCoordinate().getVersion().equals("")) {
        if (dep.getGroupId().equals(ArtifactVault.ERRAI_GROUP_ID))
          dep.setVersion(Property.ErraiVersion.invoke());
        else
          dep.setVersion(versionFacet.resolveVersion(dep.getGroupId(), dep.getCoordinate().getArtifactId()));
      }
      plugin.addPluginDependency(dep);
    }

    for (final Execution exec : getExecutions()) {
      plugin.addExecution(exec);
    }
    pluginFacet.addPlugin(plugin);

    return true;
  }
View Full Code Here

          continue outer;
      }
      return false;
    }

    final MavenPluginFacet pluginFacet = getProject().getFacet(MavenPluginFacet.class);
    final MavenPlugin mPlugin = pluginFacet.getPlugin(DependencyBuilder.create(getPluginArtifact().toString())
            .getCoordinate());

    outer: for (final Execution exec : getExecutions()) {
      for (final Execution pluginExec : mPlugin.listExecutions()) {
        // TODO check more than just id
View Full Code Here

  }

  @Override
  public boolean uninstall() {
    maybeInit();
    final MavenPluginFacet pluginFacet = getProject().getFacet(MavenPluginFacet.class);
    pluginFacet.removePlugin(DependencyBuilder.create(getPluginArtifact().toString()).getCoordinate());

    return true;
  }
View Full Code Here

{

   @Override
   public boolean install()
   {
      MavenPluginFacet pluginFacet = getFaceted().getFacet(MavenPluginFacet.class);
      MavenPluginBuilder plugin = MavenPluginBuilder
               .create()
               .setCoordinate(CoordinateBuilder.create().setGroupId("org.apache.maven.plugins")
                        .setArtifactId("maven-jar-plugin"))
               .addExecution(
                        ExecutionBuilder
                                 .create()
                                 .setId("create-forge-addon")
                                 .setPhase("package")
                                 .addGoal("jar")
                                 .setConfig(
                                          ConfigurationBuilder.create().addConfigurationElement(
                                                   ConfigurationElementBuilder.create().setName("classifier")
                                                            .setText("forge-addon"))));
      pluginFacet.addPlugin(plugin);
      return true;
   }
View Full Code Here

            .setVersion(FurnaceVersionFacet.VERSION_PROPERTY);

   @Override
   public boolean install()
   {
      MavenPluginFacet pluginFacet = getFaceted().getFacet(MavenPluginFacet.class);
      MavenPluginBuilder plugin = MavenPluginBuilder
               .create()
               .setCoordinate(FURNACE_PLUGIN_COORDINATE)
               .addExecution(
                        ExecutionBuilder
                                 .create()
                                 .setId("generate-dot")
                                 .setPhase("prepare-package")
                                 .addGoal("generate-dot")
                                 .setConfig(ConfigurationBuilder.create().addConfigurationElement(
                                          ConfigurationElementBuilder.create().setName("attach")
                                                   .setText("true"))));
      pluginFacet.addPlugin(plugin);
      return true;
   }
View Full Code Here

         for (DirectoryResource folder : this.getWebRootDirectories())
         {
            folder.mkdirs();
         }

         MavenPluginFacet plugins = getFaceted().getFacet(MavenPluginFacet.class);
         Coordinate mvnWarPluginDep = CoordinateBuilder.create().setGroupId("org.apache.maven.plugins")
                  .setArtifactId("maven-war-plugin")
                  .setVersion("2.3");

         MavenPlugin plugin;
         if (!plugins.hasPlugin(mvnWarPluginDep))
         {
            plugin = MavenPluginBuilder.create().setCoordinate(mvnWarPluginDep);
            plugins.addPlugin(plugin);
         }
         else
         {
            plugin = plugins.getPlugin(mvnWarPluginDep);
         }

         if (plugin.getConfig() == null)
         {

         }

         if (!plugin.getConfig().hasConfigurationElement("failOnMissingWebXml"))
         {
            plugin.getConfig().addConfigurationElement(
                     ConfigurationElementBuilder.create().setName("failOnMissingWebXml").setText("false"));
         }
         else
         {
            ConfigurationElementBuilder configElement = ConfigurationElementBuilder.createFromExisting(plugin
                     .getConfig().getConfigurationElement("failOnMissingWebXml"));
            plugin.getConfig().removeConfigurationElement("failOnMissingWebXml");
            plugin.getConfig().addConfigurationElement(configElement);
         }

         plugins.removePlugin(mvnWarPluginDep);
         plugins.addPlugin(plugin);
      }
      return true;
   }
View Full Code Here

TOP

Related Classes of org.jboss.forge.addon.maven.projects.MavenPluginFacet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.