You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Mirko Friedenhagen <mf...@gmail.com> on 2011/12/10 22:40:54 UTC

maven-enforcer-plugin: requireProperty example with wrong regex for project.version?

Hello,

I followed the instructions from
http://maven.apache.org/enforcer/enforcer-rules/requireProperty.html
and put the example configuration into my pom:

                           <requireProperty>
                                <property>project.version</property>
                                <message>"Project version must be
specified."</message>
                                <regex>(\d|-SNAPSHOT)$</regex>
                                <regexMessage>"Project version must
end in a number or -SNAPSHOT."</regexMessage>
                            </requireProperty>

My project.version does end in -SNAPSHOT, however Maven keeps complaining:
[DEBUG] Executing rule: org.apache.maven.plugins.enforcer.RequireProperty
[DEBUG] Adding failure due to exception
org.apache.maven.enforcer.rule.api.EnforcerRuleException: "Project
version must end in a number or -SNAPSHOT."
	at org.apache.maven.plugins.enforcer.RequireProperty.execute(RequireProperty.java:81)

Looking at http://svn.apache.org/viewvc/maven/enforcer/tags/1.0.1/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireProperty.java?view=markup
the rule uses String.matches in line 73.

Changing to <regex>.*(\d|-SNAPSHOT)$</regex> does succeed, so probabyl
only the example is wrong.

Regards Mirko
--
http://illegalstateexception.blogspot.com/
https://github.com/mfriedenhagen/
https://bitbucket.org/mfriedenhagen/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org