Uploaded image for project: 'Forge'
  1. Forge
  2. FORGE-432

forge source-plugin cannot resolve dependency with property version

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Minor
    • 1.0.0.CR1
    • 1.0.0.Beta5
    • None

    Description

      Hey there,

      here is the new issue to my problem. I copied the description from FORGE-430 and updated it a bit.

      Task:

      Install a plugin from a local project with dependencies to some library not provided or known by Forge

      Command:

      forge source-plugin

      The way to the failure:

      ForgePlugin.installFromLocalProject invokes
      ForgePlugin.installFromCurrentProject invokes
      ForgePlugin.createModule invokes
      ForgePlugin.createDependenciesModule invokes
      ForgePlugin.resolveArtifacts invokes
      MavenDependencyFacet.getDependencies which finally invokes

      MavenCoreFacet maven = project.getFacet(MavenCoreFacet.class);
      Model pom = maven.getPOM();
      

      The problem is, that ForgePlugin.resolveArtifacts compares the dependencies and sets the original dependency d to d2, which comes from the MavenCoreFacet with no resolved version (but the

      {some.version} property as version).

      So maybe the problem is in the ForgePlugin.resolveArtifacts method.
      I pointed to the (possible) problem in the code snipped below.

      d comes with correct resolved version and d2 comes with the content of the version property (e.g. {some.version}

      ) as "version".
      The comparison is successfull, but afterwards the new "version" can't be resolved (because its something like

      {some.version}

      )

      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; //<- this results in a "Could not resolve dependency" message
                  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;
      }
      

      Important
      This issue doesn't seem to have influence on the functionality of the plugin, maybe because I shaded the dependencies to Forge.

      Hope you can reproduce this issue, otherwise I can give you a pom snipped with my dependencies.

      Best regards

      Max

      Attachments

        Activity

          People

            lincolnthree Lincoln Baxter III (Inactive)
            mxsb_jira Max Schwaab (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: