IMO John's solution, or something similar, is the Maven Way. Any solution involving profiles is bad and should be avoided at all costs.
/Anders On Fri, Aug 14, 2020 at 10:53 AM John Patrick <nhoj.patr...@gmail.com> wrote: > I would do the following snippet, not sure if phase is needed, not > sure if it should be pluginManagement, but i tend to put all > configuration in pluginManagement then only the usage in plugins. > > For the query, from what I'm aware I used the same id of default, it > will override that execution from main and use the updated execution > in the query. > > I've not had to do this override with enforcer before, but have had to > do something similar with the compiler plugin when building a project > in java 1.8 and 11 and 14. > > What my pom's might look like, i've not tested this setup and it might > need some tweaking; > > main/pom.xml > > <build><pluginManagement><plugins> > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-enforcer-plugin</artifactId> > <version>3.0.0-M2</version> > <executions> > <execution> > <id>default</id> > <phase>validate</phase> > <goals> > <goal>enforce</goal> > </goals> > <configuration> > <rules> > <DependencyConvergence/> > <requireJavaVersion> > <version>[1.8,)</version> > <message>*** This project requires > JDK 1.8/J2SE 8 or later. ***</message> > </requireJavaVersion> > </rules> > <fail>true</fail> > </configuration> > </execution> > </executions> > </plugin> > <plugins> > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-enforcer-plugin</artifactId> > </plugin> > </plugins></builds> > > query/pom.xml > > <build><plugins> > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-enforcer-plugin</artifactId> > <executions> > <execution> > <id>default</id> > <phase>validate</phase> > <goals> > <goal>enforce</goal> > </goals> > <configuration> > <rules> > <requireJavaVersion> > <version>[1.8,)</version> > <message>*** This project requires > JDK 1.8/J2SE 8 or later. ***</message> > </requireJavaVersion> > </rules> > <fail>true</fail> > </configuration> > </execution> > </executions> > </plugin> > </plugins></builds> > > John > > On Thu, 13 Aug 2020 at 11:13, Falko Modler <f.mod...@gmx.net> wrote: > > > > You could split your config into multiple executions and define a custom > skip property for each execution. > > In a submodule you could then skip the executions you don't want (or > vice versa) by adding the respective properties. > > Skipping all enforcer rules (e.g. for a "quick" local run) is more > complicated, but could be achieved if everything ia put in a profile that > is activated by default. You could then opt-out of it via -P!my-profile or > introduce yet another property for that. > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > > For additional commands, e-mail: users-h...@maven.apache.org > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > >