waffel’s Weblog

November 18, 2010

disable maven enforcer rule

Filed under: software — Thomas Wabner @ 6:33 pm
Tags: , , , ,

Apache maven enforcer rules are very useful in large projects. A common usage of such enforcer rules is to define them in a central point like a project parent pom.xml. For example following enforcer definition can be set in a pom parent:

package-parent pom.xml:

                <regexMessage>You must compile with Java 1.4, as long our servers run in old NetWeaver!</regexMessage>

This enforcer rule should ensure that all projects, which using the parent POM using a Java 1.4 compiler.

Often such parent pom defines many other useful properties and settings for projects. If you want to use these definition and ONLY want to disable the enforcer rule you can simple do follow „trick“:


     <!-- we need to overide the enforcer rules here because we have java 1.6 and not the  old 1.4 -->

I use the same approach here as described in my article how to diable a inherited maven plugin.


3 Kommentare »

  1. Thanks, that was pretty handy way to disable an inherrited enforcer rule!

    Kommentar von ross — September 27, 2011 @ 12:30 pm | Antwort

  2. OR you can use -Denforcer.skip=true

    Kommentar von Ranga — Januar 12, 2012 @ 1:43 pm | Antwort

    • Thanks Ranga,

      yes and No … if you want to disable ALL enforcer rules you are right … but with my suggested approach you can skip/disable a specific rule (often you have many different enforcer rules and you want for example skip only a subset of them … in my example the java-1.4 enforcing).

      Kommentar von Thomas Wabner — Januar 12, 2012 @ 2:21 pm | Antwort

RSS feed for comments on this post. TrackBack URI

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:


Du kommentierst mit Deinem WordPress.com-Konto. Abmelden /  Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden /  Ändern )


Du kommentierst mit Deinem Twitter-Konto. Abmelden /  Ändern )


Du kommentierst mit Deinem Facebook-Konto. Abmelden /  Ändern )


Verbinde mit %s

Bloggen auf WordPress.com.

%d Bloggern gefällt das: