Package org.jboss.forge.addon.dependencies

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


   public Dependency install(final Project project, final Dependency dependency)
   {
      DependencyFacet deps = project.getFacet(DependencyFacet.class);

      // Exists in deps, no version change requested
      Dependency unversioned = getUnversioned(dependency);
      Dependency existing = deps.getEffectiveDependency(unversioned);
      Dependency existingManaged = deps.getEffectiveManagedDependency(unversioned);

      if (existing != null) // we already have the dep
      {
         if (!Strings.isNullOrEmpty(existing.getCoordinate().getVersion())
                  && (existing.getCoordinate().getVersion().equals(dependency.getCoordinate().getVersion())
                  || Strings.isNullOrEmpty(dependency.getCoordinate().getVersion())))
         {
            /*
             * The version is the same as requested, or no specific version was requested. No action required.
             */
            return existing;
         }
         else
         {
            /*
             * Version is different. Update it.
             */
            return updateAll(deps, dependency, unversioned);
         }
      }
      else if (existingManaged != null)
      {
         /*
          * we don't have a dependency, or the existing dependency did not have a version, but we do have a managed
          * dependency
          */
         if (!Strings.isNullOrEmpty(existingManaged.getCoordinate().getVersion())
                  && (existingManaged.getCoordinate().getVersion().equals(dependency.getCoordinate().getVersion())
                  || Strings.isNullOrEmpty(dependency.getCoordinate().getVersion())))
         {
            /*
             * We have a version already, or the version is the same as requested, or no specific version was requested.
             * No need to touch dep management because we already have the right version.
             */
            deps.removeDependency(dependency);
            updateDependency(deps, unversioned);
            return existingManaged;
         }
         else
         {
            /*
             * Version is different or unspecified, and we had no existing version.
             */
            return updateAll(deps, dependency, unversioned);
         }
      }
      else
      {
         Dependency toInstall = dependency;
         if (Strings.isNullOrEmpty(dependency.getCoordinate().getVersion()))
         {
            List<Coordinate> versions = deps.resolveAvailableVersions(DependencyQueryBuilder.create(
                     dependency.getCoordinate()).setFilter(new NonSnapshotDependencyFilter()));

View Full Code Here


   private DependencyInstaller installer;

   @Override
   public boolean install()
   {
      Dependency dependency = installer.install(getFaceted(), FORGE_API_DEPENDENCY);
      return dependency != null;
   }
View Full Code Here

      {
         int count = 0;
         for (Dependency dependency : arguments.getValue())
         {

            Dependency existingDep = deps.getEffectiveManagedDependency(DependencyBuilder.create(dependency)
                     .setVersion(
                              null));
            if (existingDep != null)
            {
               if (context.getPrompt().promptBoolean(
                        String.format("Dependency is already managed [%s:%s:%s], reference the managed dependency?",
                                 existingDep.getCoordinate().getGroupId(), existingDep.getCoordinate().getArtifactId(),
                                 existingDep.getCoordinate().getVersion())))
               {
                  return Results.success("Project not updated: No changes required.");
               }
            }
View Full Code Here

   @Override
   public void addDirectDependency(Dependency dep)
   {
      GradleModelBuilder model = GradleModelBuilder.create(getGradleFacet().getModel());

      Dependency newDep = null;
      // If dependency has no version set, and there is no corresponding dep in managed list
      if (dep.getCoordinate().getVersion() == null &&
               resolveVersionIn(getEffectiveManagedDependencies(), dep) == null)
      {
         // Then try to resolve version in imports
View Full Code Here

   {
      getGradleFacet().installForgeLibrary();
     
      GradleModelBuilder model = GradleModelBuilder.create(getGradleFacet().getModel());

      Dependency newDep = null;
      // First try to enforce version using imported dependencies (like Maven do)
      newDep = resolveVersionIn(getEffectiveImports(), dep);
      if (newDep == null)
      {
         newDep = dep;
View Full Code Here

      return deps;
   }

   private Dependency gradleDepToForgeDep(GradleDependency gradleDep)
   {
      Dependency forgeDep;
      forgeDep = DependencyBuilder.create()
               .setScopeType(gradleDep.getConfiguration().toMavenScope())
               .setGroupId(gradleDep.getGroup())
               .setArtifactId(gradleDep.getName())
               .setVersion(gradleDep.getVersion())
View Full Code Here

      if (arguments.hasValue())
      {
         int count = 0;
         for (Dependency gav : arguments.getValue())
         {
            Dependency existingDep = deps.getEffectiveManagedDependency(DependencyBuilder.create(gav).setVersion(null));
            if (existingDep != null)
            {
               if (context.getPrompt().promptBoolean(String.format(
                        "Dependency [%s:%s] is currently managed. "
                                 + "Reference the existing managed dependency [%s:%s:%s]?",
                        gav.getCoordinate().getArtifactId(),
                        gav.getCoordinate().getGroupId(),
                        existingDep.getCoordinate().getGroupId(),
                        existingDep.getCoordinate().getArtifactId(),
                        existingDep.getCoordinate().getVersion())))
               {
                  gav = existingDep;
               }
            }
View Full Code Here

      {
         int count = 0;
         for (Dependency dependency : arguments.getValue())
         {

            Dependency existingDep = deps.getEffectiveManagedDependency(DependencyBuilder.create(dependency)
                     .setVersion(
                              null));
            if (existingDep != null)
            {
               if (context.getPrompt().promptBoolean(
                        String.format("Dependency is already managed [%s:%s:%s], reference the managed dependency?",
                                 existingDep.getCoordinate().getGroupId(), existingDep.getCoordinate().getArtifactId(),
                                 existingDep.getCoordinate().getVersion())))
               {
                  return Results.success("Project not updated: No changes required.");
               }
            }
View Full Code Here

{
   @Override
   public Dependency install(final Project project, final Dependency request)
   {
      DependencyFacet deps = project.getFacet(DependencyFacet.class);
      final Dependency dependency = deps.resolveProperties(request);

      // Exists in deps, no version change requested
      Dependency unversioned = getUnversioned(dependency);
      Dependency existing = deps.getEffectiveDependency(unversioned);
      Dependency existingManaged = deps.getEffectiveManagedDependency(unversioned);

      if (existing != null) // we already have the dep
      {
         if (!Strings.isNullOrEmpty(existing.getCoordinate().getVersion())
                  && (existing.getCoordinate().getVersion().equals(dependency.getCoordinate().getVersion())
                  || Strings.isNullOrEmpty(dependency.getCoordinate().getVersion())))
         {
            /*
             * The version is the same as requested, or no specific version was requested. No action required.
             */
            return existing;
         }
         else
         {
            /*
             * Version is different. Update it.
             */
            return updateAll(deps, dependency, unversioned);
         }
      }
      else if (existingManaged != null)
      {
         /*
          * we don't have a dependency, or the existing dependency did not have a version, but we do have a managed
          * dependency
          */
         if (!Strings.isNullOrEmpty(existingManaged.getCoordinate().getVersion())
                  && (existingManaged.getCoordinate().getVersion().equals(dependency.getCoordinate().getVersion())
                  || Strings.isNullOrEmpty(dependency.getCoordinate().getVersion())))
         {
            /*
             * We have a version already, or the version is the same as requested, or no specific version was requested.
             * No need to touch dep management because we already have the right version.
             */
            deps.removeDependency(dependency);
            updateDependency(deps, unversioned);
            return existingManaged;
         }
         else
         {
            /*
             * Version is different or unspecified, and we had no existing managed dependency.
             */
            return updateAll(deps, dependency, unversioned);
         }
      }
      else
      {
         Dependency toInstall = dependency;
         if (Strings.isNullOrEmpty(dependency.getCoordinate().getVersion()))
         {
            List<Coordinate> versions = deps.resolveAvailableVersions(DependencyQueryBuilder.create(
                     dependency.getCoordinate()).setFilter(new NonSnapshotDependencyFilter()));

View Full Code Here

   }

   private void addAddonDependency(Project project, StringBuilder body, StringBuilder dependenciesAnnotationBody,
            AddonId addonId)
   {
      Dependency dependency = DependencyBuilder.create(addonId.getName()).setVersion(
               addonId.getVersion().toString()).setScopeType("test");
      String name = addonId.getName();
      if (!dependencyInstaller.isInstalled(project, dependency))
      {
         dependencyInstaller.install(project, dependency);
View Full Code Here

TOP

Related Classes of org.jboss.forge.addon.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.