Uploaded image for project: 'Ivy'
  1. Ivy
  2. IVY-123

artifactproperty does not set the [conf] token in the pattern to the correct value. It is always set to 'default'.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.1, 1.2
    • 1.3.1
    • Ant
    • None
    • Windows XP
      Ant 1.6.5

    Description

      When I use the following ant task, the [conf] token is always default.

      <ivy:artifactproperty conf="src" name="[organisation].[module].[artifact]"
      value="/[conf]/[artifact]-[revision].[ext]"/>

      The problem is in the way IvyArtifactProperty is calling IvyPatternHelper.substitute.

      public static String substitute(String pattern, Artifact artifact)

      { return substitute(pattern, artifact.getModuleRevisionId().getOrganisation(), artifact.getModuleRevisionId().getName(), artifact.getModuleRevisionId().getRevision(), artifact.getName(), artifact.getType(), artifact.getExt(), null); }

      The last parameter of null causes the [conf] token to be substituted with default.

      The following change to IvyArtifactProperty.execute() fixed this bug.

      XmlReportParser parser = new XmlReportParser();
      String[] confs = splitConfs(_conf);
      Collection all = new HashSet();
      for (int i = 0; i < confs.length; i++) {
      Artifact[] artifacts = parser.getArtifacts(new ModuleId(_organisation, _module), confs[i], _cache);
      //all.addAll(Arrays.asList(artifacts));
      for (int j = 0; j < artifacts.length; j++)

      { Artifact artifact = artifacts[j]; String name = IvyPatternHelper.substitute(ivy.substitute(getName()), artifact, confs[i]); String value = IvyPatternHelper.substitute(ivy.substitute(getValue()), artifact, confs[i]); getProject().setProperty(name, value); }

      }

      Including the following addition to IvyPatternHelper

      public static String substitute(String pattern, Artifact artifact, String conf)

      { return substitute(pattern, artifact.getModuleRevisionId().getOrganisation(), artifact.getModuleRevisionId().getName(), artifact.getModuleRevisionId().getRevision(), artifact.getName(), artifact.getType(), artifact.getExt(), conf); }

      Attachments

        Activity

          People

            xavier Xavier Hanin
            peterox Peter Oxenham
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: