Package org.jboss.forge.project.facets

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


   public void repoAdd(
            @Option(description = "repository name...", required = true) final String name,
            @Option(description = "repository URL...", required = true) final String url,
            final PipeOut out)
   {
      DependencyFacet deps = project.getFacet(DependencyFacet.class);

      if (deps.hasRepository(url))
      {
         out.println("Repository exists [" + url + "]");
      }
      else
      {
         deps.addRepository(name, url);
         out.println("Added repository [" + name + "->" + url + "]");
      }
   }
View Full Code Here


   public void repoRemove(
            @Option(required = true, description = "repo url...",
                     completer = RepositoryCompleter.class) final String url,
            final PipeOut out)
   {
      DependencyFacet deps = project.getFacet(DependencyFacet.class);

      DependencyRepository rep;
      if ((rep = deps.removeRepository(url)) != null)
      {
         out.println("Removed repository [" + rep.getId() + "->" + rep.getUrl() + "]");
      }
      else
      {
View Full Code Here

   }

   @Command("list-repositories")
   public void repoList(final PipeOut out)
   {
      DependencyFacet deps = project.getFacet(DependencyFacet.class);
      List<DependencyRepository> repos = deps.getRepositories();

      for (DependencyRepository repo : repos)
      {
         out.print(repo.getId() + "->");
         out.println(ShellColor.BLUE, repo.getUrl());
View Full Code Here

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

         DependencyFacet deps = project.getFacet(DependencyFacet.class);
         if (!deps.hasEffectiveDependency(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.addDirectDependency(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");
      dependencies.createChild("module").attribute("name", "org.jboss.forge.shell.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

      meta.setTopLevelPackage(javaPackage);

      PackagingFacet packaging = project.getFacet(PackagingFacet.class);
      packaging.setPackagingType(type);

      DependencyFacet deps = project.getFacet(DependencyFacet.class);
      deps.addRepository(KnownRepository.JBOSS_NEXUS);

      if (packaging.getPackagingType().equals(PackagingType.JAR) && createMain)
      {
         project.getFacet(JavaSourceFacet.class).saveJavaSource(JavaParser
                  .create(JavaClass.class)
View Full Code Here

                     name = "offlineSearch"
            ) final boolean offline,
            final PipeOut out
            )
   {
      DependencyFacet manDeps = project.getFacet(DependencyFacet.class);
      if ((gav.getVersion() == null) || gav.getVersion().trim().isEmpty())
      {
         gav = DependencyBuilder.create(gav).setVersion("[0,)");
      }
      List<Dependency> versions = manDeps.resolveAvailableVersions(gav);

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

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

   }

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

      for (Dependency manDep : manDeps.getManagedDependencies())
      {
         printDep(out, manDep);
      }
   }
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.