Skip to end of metadata
Go to start of metadata

This is now solved with the enforcer: http://maven.apache.org/enforcer/enforcer-rules/requireProperty.html

currently, Maven does not require declaration of properties used in the pom, you just use them anywhere you like. Usually, if a property is missing, bad things tend to happen because it is replaced with the string "null". On a good day, resources from "translations-null-null" aren't included in the build, on bad days it's worse... And when you find the missing property in a pom you haven't written, you have to figure out what "${lopt}" means and what its legal values are...

So instead typing

<properties>
    <lopt>en_US</lopt>
</properties>

this proposal wants you to write

<properties>
    <property>
        <name>lopt</name>
        <defaultValue>en_US</defaultValue>
        <required>true</required>
        <description>Locale to use</description>
        <options>
            <option>
                <value>de_DE</value>
                <description>Use German locale</description>
            </option>
        </options>
    </property>
</properties>

Of course, Maven should display an error if a required variable is missing. And it would be nice to have "help:describe-properties"...

  • No labels