When will the https://maven.apache.org/pom.html schema be up for
modification?

I notice that a duplicate property made its way into one of my pom.xml
Can often happen when resolving conflicts.

<properties>
  <version.postgresql>42.5.0</version.postgresql>
  <version.postgresql>42.6.0</version.postgresql>
  ...
</properties>

Since XML allows this, as does the schema, the enforcer plugin has no rule
for this, and the IDE doesn't complain
see
https://youtrack.jetbrains.com/issue/IDEA-54414/maven-highlight-duplicate-property-definitions-in-same-pom.xml
I had a pom with this property defined twice.

Since the children of properties are not defined in the schema its not
possible to use the "unique" tag (I believe).
That's with schema v1.0. But it can be done in schema v1.1 using an assert

      <xs:element minOccurs="0" name="properties">
        <xs:annotation>
          <xs:documentation source="version">4.0.0+</xs:documentation>
          <xs:documentation source="description">

            Properties that can be used throughout the POM as a
substitution, and
            are used as filters in resources if enabled.
            The format is
&lt;code&gt;&amp;lt;name&amp;gt;value&amp;lt;/name&amp;gt;&lt;/code&gt;.

          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:any minOccurs="0" maxOccurs="unbounded"
processContents="skip"/>
          </xs:sequence>
        </xs:complexType>
        <xs:assert test="count(distinct-values(name(*))) = count(*)"/>
      </xs:element>

Thanks,
Delany

Reply via email to