Examples of MavenCoreFacet


Examples of org.jboss.forge.maven.MavenCoreFacet

      DependencyFacet deps = project.getFacet(DependencyFacet.class);
      List<DependencyResource> pluginDependencies = new ArrayList<DependencyResource>();

      // Hack to invalidate the cached full project build result in the MavenCoreFacet
      // Thie ensures that resolution of any unresolved dependencies in a multi-module project will be re-attempted.
      MavenCoreFacet mvn = project.getFacet(MavenCoreFacet.class);
      mvn.setPOM(mvn.getPOM());

      List<Dependency> effectiveDependenciesInScopes = deps.getEffectiveDependenciesInScopes(ScopeType.COMPILE,
               ScopeType.RUNTIME);
      for (Dependency d : effectiveDependenciesInScopes)
      {
View Full Code Here

Examples of org.jboss.forge.maven.MavenCoreFacet

   public void setGroupId(final PipeOut out,
            @Option(description = "the new groupId; for example: \"org.jboss.forge\"") final String groupId)
   {
      Assert.notNull(groupId, "GroupId must not be empty");

      MavenCoreFacet mvn = project.getFacet(MavenCoreFacet.class);

      Model pom = mvn.getPOM();
      pom.setGroupId(groupId);
      mvn.setPOM(pom);
      out.println("Set groupId [ " + groupId + " ]");
   }
View Full Code Here

Examples of org.jboss.forge.maven.MavenCoreFacet

   public void setArtifactId(final PipeOut out,
            @Option(description = "the new artifactId; for example: \"forge-shell\"") final String artifactId)
   {
      Assert.notNull(artifactId, "GroupId must not be empty");

      MavenCoreFacet mvn = project.getFacet(MavenCoreFacet.class);

      Model pom = mvn.getPOM();
      pom.setArtifactId(artifactId);
      mvn.setPOM(pom);
      out.println("Set artifactId [ " + artifactId + " ]");
   }
View Full Code Here

Examples of org.jboss.forge.maven.MavenCoreFacet

   public void setVersion(final PipeOut out,
            @Option(description = "the new version; for example: \"1.0.0.Final\"") final String version)
   {
      Assert.notNull(version, "GroupId must not be empty");

      MavenCoreFacet mvn = project.getFacet(MavenCoreFacet.class);

      Model pom = mvn.getPOM();
      pom.setVersion(version);
      mvn.setPOM(pom);

      out.println("Set version [ " + version + " ]");
   }
View Full Code Here

Examples of org.jboss.forge.maven.MavenCoreFacet

   public void setName(final PipeOut out,
            @Option(description = "the new name; for example: \"UI-Layer\"") final String name)
   {
      Assert.notNull(name, "Name must not be empty");

      MavenCoreFacet mvn = project.getFacet(MavenCoreFacet.class);

      Model pom = mvn.getPOM();
      pom.setName(name);
      mvn.setPOM(pom);

      out.println("Set name [ " + name + " ]");
   }
View Full Code Here

Examples of org.jboss.forge.maven.MavenCoreFacet

            @Option(name = "parentProjectRoot",
                     description = "absolute location of a project to use as this project's direct parent",
                     required = false) final Resource<?> path,
            final PipeOut out)
   {
      MavenCoreFacet mvn = project.getFacet(MavenCoreFacet.class);
      Parent parent = null;
      if (gav != null)
      {
         Assert.notNull(gav.getArtifactId(), "ArtifactId must not be null [" + gav.toCoordinates() + "]");
         Assert.notNull(gav.getGroupId(), "GroupId must not be null [" + gav.toCoordinates() + "]");
         Assert.notNull(gav.getVersion(), "Version must not be null [" + gav.toCoordinates() + "]");

         parent = new Parent();
         parent.setArtifactId(gav.getArtifactId());
         parent.setGroupId(gav.getGroupId());
         parent.setVersion(gav.getVersion());

         if (relativePath != null)
         {
            parent.setRelativePath(relativePath);
         }

         Model pom = mvn.getPOM();
         pom.setParent(parent);
         mvn.setPOM(pom);
      }
      else if ((path != null) && factory.containsProject(path.reify(DirectoryResource.class)))
      {
         Project parentProject = factory.findProject(path.reify(DirectoryResource.class));
         MavenCoreFacet parentCore = parentProject.getFacet(MavenCoreFacet.class);

         parent = new Parent();
         parent.setArtifactId(parentCore.getMavenProject().getArtifactId());
         parent.setGroupId(parentCore.getMavenProject().getGroupId());
         parent.setVersion(parentCore.getMavenProject().getVersion());

         if (relativePath != null)
         {
            parent.setRelativePath(relativePath);
         }

         Model pom = mvn.getPOM();
         pom.setParent(parent);
         mvn.setPOM(pom);
      }
      else if (relativePath != null)
      {
         PathspecParser parser = new PathspecParser(resources, shell.getCurrentProject().getProjectRoot(), relativePath);
         List<Resource<?>> resolvedResources = parser.resolve();
         if (!resolvedResources.isEmpty()
                  && factory.containsProject(resolvedResources.get(0).reify(DirectoryResource.class)))
         {
            Project parentProject = factory.findProject(resolvedResources.get(0).reify(DirectoryResource.class));
            MavenCoreFacet parentCore = parentProject.getFacet(MavenCoreFacet.class);

            parent = new Parent();
            parent.setArtifactId(parentCore.getMavenProject().getArtifactId());
            parent.setGroupId(parentCore.getMavenProject().getGroupId());
            parent.setVersion(parentCore.getMavenProject().getVersion());
            parent.setRelativePath(relativePath);

            Model pom = mvn.getPOM();
            pom.setParent(parent);
            mvn.setPOM(pom);
View Full Code Here

Examples of org.jboss.forge.maven.MavenCoreFacet

   }

   @Command("remove-parent")
   public void removeParent(final PipeOut out)
   {
      MavenCoreFacet mvn = project.getFacet(MavenCoreFacet.class);

      Model pom = mvn.getPOM();
      Parent parent = pom.getParent();

      if (parent != null)
      {
         String parentId = parent.getGroupId() + ":" + parent.getArtifactId() + ":"
                  + parent.getVersion() + " ("
                  + (parent.getRelativePath() == null ? " " : parent.getRelativePath() + ")");

         if (shell.promptBoolean("Are you sure you want to remove all parent information from this project? [ "
                  + parentId + "]", false))
         {
            out.println("Removed parent [ " + parentId + " ]");
            pom.setParent(null);
            mvn.setPOM(pom);
         }
         else
         {
            out.println("Aborted...");
         }
View Full Code Here

Examples of org.jboss.forge.maven.MavenCoreFacet

   }

   private List<MavenPlugin> listConfiguredPlugins(boolean managedPlugin)
   {
      List<MavenPlugin> plugins = new ArrayList<MavenPlugin>();
      MavenCoreFacet mavenCoreFacet = project.getFacet(MavenCoreFacet.class);
      Build build = mavenCoreFacet.getPOM().getBuild();
      List<org.apache.maven.model.Plugin> pomPlugins = getPluginsPOM(build, managedPlugin);
      for (org.apache.maven.model.Plugin plugin : pomPlugins)
      {
         MavenPluginAdapter adapter = new MavenPluginAdapter(plugin);
         MavenPluginBuilder pluginBuilder = MavenPluginBuilder
View Full Code Here

Examples of org.jboss.forge.maven.MavenCoreFacet

      return plugins;
   }

   private void addPlugin(final MavenPlugin plugin, boolean managedPlugin)
   {
      MavenCoreFacet mavenCoreFacet = project.getFacet(MavenCoreFacet.class);
      Model pom = mavenCoreFacet.getPOM();
      Build build = pom.getBuild();
      if (build == null)
         build = new Build();
      if (managedPlugin)
      {
         PluginManagement pluginManagement = build.getPluginManagement();
         if (pluginManagement == null)
         {
            pluginManagement = new PluginManagement();
            build.setPluginManagement(pluginManagement);
         }
         pluginManagement.addPlugin(new MavenPluginAdapter(plugin));
      }
      else
      {
         build.addPlugin(new MavenPluginAdapter(plugin));
      }
      pom.setBuild(build);
      mavenCoreFacet.setPOM(pom);
   }
View Full Code Here

Examples of org.jboss.forge.maven.MavenCoreFacet

      }
   }

   private void removePlugin(final Dependency dependency, boolean managedPlugin)
   {
      MavenCoreFacet mavenCoreFacet = project.getFacet(MavenCoreFacet.class);
      Model pom = mavenCoreFacet.getPOM();
      Build build = pom.getBuild();
      List<org.apache.maven.model.Plugin> pomPlugins = getPluginsPOM(build, managedPlugin);
      Iterator<Plugin> it = pomPlugins.iterator();
      while (it.hasNext())
      {
         org.apache.maven.model.Plugin pomPlugin = it.next();
         Dependency pluginDep = DependencyBuilder.create().setGroupId(pomPlugin.getGroupId())
                  .setArtifactId(pomPlugin.getArtifactId());

         if (DependencyBuilder.areEquivalent(pluginDep, dependency))
         {
            it.remove();
         }
      }
      mavenCoreFacet.setPOM(pom);
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.