Maven
  1. Maven
  2. MNG-3638

Ability to evaluate expressions involving collections

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Incomplete
    • Affects Version/s: 2.0.9
    • Fix Version/s: None
    • Component/s: General
    • Labels:
      None
    • Environment:
      Windows XP Professional SP 2
    • Complexity:
      Intermediate
    • Number of attachments :
      0

      Description

      The following property is not resolved by Maven:

      $

      {project.build.resources.resource.directory}

      It follows the notation described to access any property within the POM, is there an alternative property that can be used to reference the resource directory?

        Activity

        Hide
        Benjamin Bentmann added a comment -

        ${project.build.resources.resource.directory}

        Note the plural form, "resources" is actually a collection (compare the Maven Model). Not sure whether Maven has some indexing syntax for accessing individual collection elements.

        Show
        Benjamin Bentmann added a comment - ${project.build.resources.resource.directory} Note the plural form, "resources" is actually a collection (compare the Maven Model ). Not sure whether Maven has some indexing syntax for accessing individual collection elements.
        Hide
        Shane Isbell added a comment -

        In 3.0, we are converting the model into URI/value pairs: so the parameter you specified would be: http://apache.org/maven/project/build/resources#collection/resource/directory. I've excluded any URI with collection from being used in interpolation because I have no idea how to choose the correct element within the collection, there being, say two resource/directory.

        If someone can come up with a solid, deterministic rule for how this can be done, I can implement it.

        Show
        Shane Isbell added a comment - In 3.0, we are converting the model into URI/value pairs: so the parameter you specified would be: http://apache.org/maven/project/build/resources#collection/resource/directory . I've excluded any URI with collection from being used in interpolation because I have no idea how to choose the correct element within the collection, there being, say two resource/directory. If someone can come up with a solid, deterministic rule for how this can be done, I can implement it.
        Hide
        Benjamin Bentmann added a comment - - edited

        If someone can come up with a solid, deterministic rule for how this can be done, I can implement it.

        Does it need more than an index operator to allow users to specify which collection element they refer to? I mean, the POM is XML, XML is a sequence of elements so all collections should in fact be lists that can be accessed via a zero-based index.

        The brackets that Java uses for array indexing are forbidden in URI paths but there are still other available delimiter characters. So, how about something like one of these:

        project/build/resources/0/directory
        project/build/resources,0/directory
        project/build/resources(0)/directory
        
        Show
        Benjamin Bentmann added a comment - - edited If someone can come up with a solid, deterministic rule for how this can be done, I can implement it. Does it need more than an index operator to allow users to specify which collection element they refer to? I mean, the POM is XML, XML is a sequence of elements so all collections should in fact be lists that can be accessed via a zero-based index. The brackets that Java uses for array indexing are forbidden in URI paths but there are still other available delimiter characters. So, how about something like one of these: project/build/resources/0/directory project/build/resources,0/directory project/build/resources(0)/directory
        Hide
        Benjamin Bentmann added a comment -
        Show
        Benjamin Bentmann added a comment - See also Expression Access to POM List Elements .
        Show
        Jason van Zyl added a comment - Please refer to https://cwiki.apache.org/confluence/display/MAVEN/The+Great+JIRA+Cleanup+of+2014
        Hide
        Jason van Zyl added a comment -

        Please refer to https://cwiki.apache.org/confluence/display/MAVEN/The+Great+JIRA+Cleanup+of+2014 if you're wondering why this issue was closed out.

        Show
        Jason van Zyl added a comment - Please refer to https://cwiki.apache.org/confluence/display/MAVEN/The+Great+JIRA+Cleanup+of+2014 if you're wondering why this issue was closed out.

          People

          • Assignee:
            Unassigned
            Reporter:
            Matthew Tordoff
          • Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: