Search code examples
javamaven

Maven Properties referring to itself


It is allowed to have a Maven property of the following form?

<prop>${prop}</prop>

Unfortunately this is not in my Pom, so I cannot change it. Then the Maven Model Builder throws Null Pointer Exceptions at the point where it tries to parse the property. If this entry is removed, parsing works and it keeps the string "${prop}" wherever the property is used.

Apparently the developers of the pom must have had a reason, why they added this entry in the first place. I presume it is somehow to make sure that the build fails if this property does not exist.

However this makes resolving the poms quite challenging if I have this as a transitive dependency.

Is this allowed according to Maven ? If yes, then I will report a bug, if no I have to deal with it somehow. I could not find a detailed specification for Maven-Properties.


Solution

  • It seems like self-referencing properties where not intended to be used by Maven. We can only speculate what the precise intentions of the authors were.

    I created a bug report at https://issues.apache.org/jira/browse/MNG-8174 with more details about how to reproduce the issue.