Package org.jboss.forge.project.facets

Examples of org.jboss.forge.project.facets.DependencyFacet


                     type = PromptType.DEPENDENCY_ID
            ) Dependency gav,
            final PipeOut out
            )
   {
      DependencyFacet deps = project.getFacet(DependencyFacet.class);
      if ((gav.getVersion() == null) || gav.getVersion().trim().isEmpty())
      {
         gav = DependencyBuilder.create(gav).setVersion("[0,)");
      }
      List<Dependency> versions = deps.resolveAvailableVersions(gav);

      for (Dependency dep : versions)
      {
         out.println(DependencyBuilder.toString(dep));
      }
View Full Code Here


                     description = "[ groupId :artifactId {:version :scope :packaging} ]",
                     help = "dependency identifier, ex: \"org.jboss.forge:forge-api:1.0.0\"") final Dependency gav,
            final PipeOut out
            )
   {
      DependencyFacet deps = project.getFacet(DependencyFacet.class);
      if (deps.hasEffectiveDependency(gav))
      {
         deps.removeDependency(gav);
         out.println("Removed dependency [" + gav + "]");
      }
      else
      {
         out.println("Dependency [" + gav + "] not found in project... ");
View Full Code Here

   }

   @Command(value = "list-dependencies", help = "List all dependencies this project includes")
   public void listDeps(final PipeOut out)
   {
      DependencyFacet deps = project.getFacet(DependencyFacet.class);

      for (Dependency dep : deps.getDependencies())
      {
         printDep(out, dep);
      }
   }
View Full Code Here

                     description = "[ groupId :artifactId {:version :scope :packaging} ]",
                     help = "managed dependency identifier, ex: \"org.jboss.forge:forge-api:1.0.0\"") Dependency gav,
            final PipeOut out
            )
   {
      DependencyFacet manDeps = project.getFacet(DependencyFacet.class);

      if (!manDeps.hasEffectiveManagedDependency(gav)
               || shell.promptBoolean(
                        "Managed dependency already exists [" + gav.getGroupId() + ":" + gav.getArtifactId()
                                 + "], continue?", true))
      {
         DependencyBuilder search = DependencyBuilder.create(gav).setVersion("[0,)");
         List<Dependency> availableVersions = manDeps.resolveAvailableVersions(search);

         if (availableVersions.isEmpty())
         {
            throw new RuntimeException("No available versions resolved for managed dependency [" + gav + "]");
         }

         if (!availableVersions.contains(gav))
         {
            ShellMessages.info(out, "No artifact found for managed dependency [" + gav + "]");
            if (availableVersions.size() > 1)
            {
               gav = shell.promptChoiceTyped("Add which version?", availableVersions);
            }
            else if (shell.promptBoolean("Use [" + availableVersions.get(0) + "] instead?", true))
            {
               gav = availableVersions.get(0);
            }
            else
            {
               throw new RuntimeException("Could not add managed dependency [" + gav + "]");
            }
         }

         if (manDeps.hasEffectiveManagedDependency(gav))
         {
            Dependency managedDependency = manDeps.getManagedDependency(gav);
            manDeps.removeManagedDependency(managedDependency);
         }
         manDeps.addManagedDependency(gav);
         out.println("Added managed dependency [" + gav + "]");
      }
      else
      {
         ShellMessages.info(out, "Aborted.");
View Full Code Here

         arquillian.setContents(this.getClass().getResourceAsStream("/web/arquillian.xml"));
      }

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

      DependencyFacet deps = project.getFacet(DependencyFacet.class);
      deps.addDirectManagedDependency(
               DependencyBuilder.create("org.jboss.arquillian:arquillian-bom:1.0.0.CR7")
                        .setPackagingType(PackagingType.BASIC).setScopeType(ScopeType.IMPORT));

      ProfileBuilder profileBuilder = ProfileBuilder
               .create()
View Full Code Here

      }
   }

   private Dependency promptVersion(Dependency dependency)
   {
      DependencyFacet dependencyFacet = project.getFacet(DependencyFacet.class);
      Dependency result = dependency;
      List<Dependency> versions = dependencyFacet.resolveAvailableVersions(DependencyQueryBuilder.create(dependency)
               .setFilter(new NonSnapshotDependencyFilter()));
      if (versions.size() > 0)
      {
         Dependency deflt = versions.get(versions.size() - 1);
         result = prompt.promptChoiceTyped("Use which version of '" + dependency.getArtifactId()
View Full Code Here

         {
            throw new IllegalStateException("Unable to recognise plugin project in ["
                     + buildDir.getFullyQualifiedName() + "]");
         }

         DependencyFacet deps = project.getFacet(DependencyFacet.class);
         if (!deps.hasDependency(DependencyBuilder.create("org.jboss.forge:forge-shell-api"))
                  && !prompt.promptBoolean("The project does not appear to be a Forge Plugin Project, install anyway?",
                           false))
         {
            throw new Abort("Installation aborted");
         }

         List<Dependency> dependencies = deps.getDependencies();
         for (Dependency dependency : dependencies) {
            if ("org.jboss.forge".equals(dependency.getGroupId())
                     && !(ScopeType.PROVIDED.equals(dependency.getScopeTypeEnum())
                     || ScopeType.TEST.equals(dependency.getScopeTypeEnum())))
            {
               ShellMessages.warn(out, "Dependency [" + dependency.toCoordinates()
                        + "] was not correctly marked as PROVIDED scope; this has been corrected.");
               deps.removeDependency(dependency);
               deps.addDependency(DependencyBuilder.create(dependency).setScopeType(ScopeType.PROVIDED));
            }
         }

         ShellMessages.info(out, "Invoking build with underlying build system.");
         Resource<?> artifact = project.getFacet(PackagingFacet.class).executeBuild();
View Full Code Here

   {
      DirectoryResource dependencyDir = getOrCreatePluginDependenciesModuleDirectory(dep);
      String pluginName = dep.getGroupId() + "." + dep.getArtifactId();
      String pluginSlot = dep.getVersion();

      DependencyFacet deps = project.getFacet(DependencyFacet.class);

      FileResource<?> moduleXml = (FileResource<?>) dependencyDir.getChild("module.xml");
      moduleXml.delete();
      moduleXml.createNewFile();

      // <resource-root path="maven-dependency.jar" />
      Node module = XMLParser.parse(getClass().getResourceAsStream("/org/jboss/forge/modules/module.xml"));
      module.attribute("name", pluginName + ".dependencies");
      module.attribute("slot", pluginSlot);
      Node resources = module.getSingle("resources");

      // <module name="org.jboss.forge:main" />
      Node dependencies = module.getSingle("dependencies");
      dependencies.createChild("module").attribute("name", "javax.api");

      List<DependencyResource> pluginDependencies = new ArrayList<DependencyResource>();
      List<Dependency> effectiveDependenciesInScopes = deps.getEffectiveDependenciesInScopes(ScopeType.COMPILE,
               ScopeType.RUNTIME);
      for (Dependency d : effectiveDependenciesInScopes) {
         if (d.getPackagingTypeEnum().equals(PackagingType.JAR)
                  && !d.getGroupId().equals("org.jboss.forge"))
         {
View Full Code Here

   private List<DependencyResource> resolveArtifacts(final Project project, final Dependency dep)
   {
      Dependency d = dep;

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

      for (Dependency d2 : deps.getDependencies()) {
         if (DependencyBuilder.areEquivalent(d, d2) && (d2.getVersion() != null))
         {
            d = d2;
            break;
         }
      }

      if (artifacts.size() != 1)
      {
         artifacts = resolver.resolveArtifacts(d, deps.getRepositories());
      }
      if (artifacts.size() != 1)
      {
         ShellMessages.warn(writer, "Could not resolve dependency [" + d.toCoordinates() + "]");
      }
View Full Code Here

   }

   @Override
   public boolean isInstalled()
   {
      DependencyFacet deps = project.getFacet(DependencyFacet.class);
      return deps.hasEffectiveDependency(JAVAEE6_FACES);
   }
View Full Code Here

TOP

Related Classes of org.jboss.forge.project.facets.DependencyFacet

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.