Package org.jboss.forge.project.facets

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


                     completer = DependencyPropertyCompleter.class) final String name,
            @Option(required = true,
                     name = "value") final String value,
            final PipeOut out)
   {
      DependencyFacet deps = project.getFacet(DependencyFacet.class);

      if (deps.getProperties().containsKey(name) &&
               shell.promptBoolean("Update property [" + name + "=" + deps.getProperty(name) + "] to new value ["
                        + value + "]", true))
      {
         deps.setProperty(name, value);
         out.println("Updated...");
      }
      else
      {
         deps.setProperty(name, value);
         out.println("Set property [" + name + "=" + value + "]");
      }
   }
View Full Code Here


   public void removeProp(
            @Option(required = true, description = "propname",
                     completer = DependencyPropertyCompleter.class) final String name,
            final PipeOut out)
   {
      DependencyFacet deps = project.getFacet(DependencyFacet.class);
      if (deps.getProperties().containsKey(name))
      {
         String value = deps.removeProperty(name);
         out.println("Removed property [" + name + "=" + value + "]");
      }
      else
      {
         out.println("No such property [" + name + "]");
View Full Code Here

   }

   @Command("list-properties")
   public void listProps(final PipeOut out)
   {
      DependencyFacet deps = project.getFacet(DependencyFacet.class);
      Map<String, String> properties = deps.getProperties();

      for (Entry<String, String> entry : properties.entrySet())
      {
         out.print(entry.getKey() + "=");
         out.println(ShellColor.BLUE, entry.getValue());
View Full Code Here

   @Command("add-known-repository")
   public void repoAdd(
            @Option(description = "type...", required = true) final KnownRepository repo,
            final PipeOut out)
   {
      DependencyFacet deps = project.getFacet(DependencyFacet.class);

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

   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.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");
         }
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

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

         DependencyFacet deps = project.getFacet(DependencyFacet.class);
         DependencyBuilder shellApi = DependencyBuilder.create("org.jboss.forge:forge-shell-api");

         String apiVersion = null;
         if (!deps.hasEffectiveDependency(shellApi)
                  && !prompt.promptBoolean("The project does not appear to be a Forge Plugin Project, install anyway?",
                           false))
         {
            throw new Abort("Installation aborted");
         }
         else
         {
            if (apiVersion == null)
            {
               Dependency directDependency = deps.getDirectDependency(shellApi);
               if ((directDependency != null) && !Strings.isNullOrEmpty(directDependency.getVersion()))
                  apiVersion = directDependency.getVersion();
            }

            if (apiVersion == null)
            {
               // Fall back to checking managed dependencies for a version
               Dependency managedDependency = deps.getManagedDependency(shellApi);
               if ((managedDependency != null) && !Strings.isNullOrEmpty(managedDependency.getVersion()))
                  apiVersion = managedDependency.getVersion();
            }

            if (apiVersion == null)
            {
               // Now completely give up and just use the result from the build
               Dependency effectiveDependency = deps.getEffectiveDependency(shellApi);
               if (effectiveDependency != null)
                  apiVersion = effectiveDependency.getVersion();
               else
                  apiVersion = environment.getRuntimeVersion();
            }
         }

         /**
          * Make sure that our PROVIDED modules are not included in the module dependencies
          */
         // TODO Weld bug requires us to correct /add module for Seam Render dependency
         List<String> groupIds = Arrays.asList("org.jboss.seam.render", "org.jboss.forge");
         List<Dependency> dependencies = deps.getDependencies();
         for (Dependency dependency : dependencies)
         {
            if (groupIds.contains(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).createBuilder().runTests(false).build();
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.