Package org.jboss.forge.project.dependencies

Examples of org.jboss.forge.project.dependencies.Dependency


   @Override
   public DirectoryResource getWebRootDirectory()
   {
      MavenPluginFacet mavenPluginFacet = project.getFacet(MavenPluginFacet.class);
      final String webappFolderName;
      Dependency mvnWarPluginDep = DependencyBuilder.create("org.apache.maven.plugins:maven-war-plugin");
      if (mavenPluginFacet.hasPlugin(mvnWarPluginDep))
      {
         MavenPlugin warPlugin = mavenPluginFacet.getPlugin(mvnWarPluginDep);
         Configuration config = warPlugin.getConfig();
         if (config.hasConfigurationElement("warSourceDirectory"))
View Full Code Here


         }
         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();
         if ((artifact != null) && artifact.exists())
         {
            MetadataFacet meta = project.getFacet(MetadataFacet.class);
            Dependency dep = meta.getOutputDependency();

            ShellMessages.info(out, "Installing plugin artifact.");

            // TODO Figure out a better plugin versioning strategy than random numbers, also see if unloading is
            // possible to avoid this entirely.
            createModule(project,
                     DependencyBuilder.create(dep).setVersion(dep.getVersion() + "-" + UUID.randomUUID().toString()),
                     artifact, apiVersion);
         }
         else
         {
            throw new IllegalStateException("Build artifact [" + artifact.getFullyQualifiedName()
View Full Code Here

      moduleXml.setContents(XMLParser.toXMLString(module));
   }

   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() + "]");
      }

      return artifacts;
   }
View Full Code Here

   public boolean install()
   {
      DependencyFacet deps = project.getFacet(DependencyFacet.class);

      List<Dependency> versions = deps.resolveAvailableVersions("org.jboss.forge:forge-shell-api:[,]");
      Dependency version = shell.promptChoiceTyped("Install which version of the Forge API?", versions);
      deps.setProperty("forge.api.version", version.getVersion());
      DependencyBuilder dep = DependencyBuilder.create("org.jboss.forge:forge-shell-api:${forge.api.version}");
      deps.addDependency(dep);
      return true;
   }
View Full Code Here

   }

   @Override
   public boolean isInstalled()
   {
      Dependency dep = DependencyBuilder.create("org.jboss.forge:forge-shell-api");
      PackagingType packagingType = project.getFacet(PackagingFacet.class).getPackagingType();
      return project.getFacet(DependencyFacet.class).hasDependency(dep)
               && PackagingType.JAR.equals(packagingType);
   }
View Full Code Here

         ShellMessages.info(out, "Invoking build with underlying build system.");
         Resource<?> artifact = project.getFacet(PackagingFacet.class).executeBuild();
         if ((artifact != null) && artifact.exists())
         {
            MetadataFacet meta = project.getFacet(MetadataFacet.class);
            Dependency dep = meta.getOutputDependency();

            ShellMessages.info(out, "Installing plugin artifact.");
            createModule(project, dep, artifact);
         }
         else
View Full Code Here

      moduleXml.setContents(XMLParser.toXMLString(module));
   }

   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() + "]");
      }

      return artifacts;
   }
View Full Code Here

         DependencyResult artifacts = system.resolveDependencies(session, request);

         for (ArtifactResult a : artifacts.getArtifactResults())
         {
            File file = a.getArtifact().getFile();
            Dependency d = DependencyBuilder.create().setArtifactId(a.getArtifact().getArtifactId())
                     .setGroupId(a.getArtifact().getGroupId()).setVersion(a.getArtifact().getVersion());
            DependencyResource resource = new DependencyResource(factory, file, d);
            result.add(resource);
         }
         return result;
View Full Code Here

         ArtifactDescriptorRequest ar = new ArtifactDescriptorRequest(artifact, convertToMavenRepos(repositories), null);
         ArtifactDescriptorResult results = system.readArtifactDescriptor(session, ar);

         Artifact a = results.getArtifact();
         Dependency d = DependencyBuilder.create().setArtifactId(a.getArtifactId()).setGroupId(a.getGroupId())
                  .setVersion(a.getVersion());

         return new DependencyMetadataImpl(d, results);
      }
      catch (Exception e)
View Full Code Here

         ShellMessages.info(out, "Invoking build with underlying build system.");
         Resource<?> artifact = project.getFacet(PackagingFacet.class).executeBuild();
         if ((artifact != null) && artifact.exists())
         {
            MetadataFacet meta = project.getFacet(MetadataFacet.class);
            Dependency dep = meta.getOutputDependency();

            ShellMessages.info(out, "Installing plugin artifact.");
            createModule(project, dep, artifact);
         }
         else
View Full Code Here

TOP

Related Classes of org.jboss.forge.project.dependencies.Dependency

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.