Details
-
Type:
New Feature
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.5.7
-
Labels:None
-
Environment:plexus-utils 1.4.3-SNAPSHOT
-
Testcase included:yes
-
Patch Submitted:Yes
-
Number of attachments :
Description
I needed the ability to get values from lists in the Maven POM, like so:
project.developers.0.id (should give me project.getDevelopers().get(0).getId()).
I couldn't find how to do it, and after looking in the 1.4.3 trunk source of Plexus Utils, found that it was impossible to do as it stands (correct me if I'm wrong).
This patch has been created using the premise that Java variable names cannot be numbers. Thus, if the property token is an integer, treat it as an index and call get(), otherwise continue as normal.
The JUnit test for the affected class has been patched too, and runs successfully.
What would be really nice is the ability to have some way to use an XPath!
<project>
{user.name}...
<properties>
<scm.user.name>${'urn:xpath:/project/developers/developer[properties/user.name="$
"]/id'}</scm.user.name>
</properties>
</project>
Or that may be crazy talk?