Hello,

While I do agree that it is not very intuitive, I don’t think there is any 
chance to change this in a compatible way.

 Also it’s pretty easy to understand: just remember this simplification: you 
can only define properties, and if the configuration should be affected by them 
you need to have a property explicitly in the POMs or as implicated default 
value. With this info in mind Mojo Docs are much easier to read ;)

Gruß
Bernd
--
https://Bernd.eckenfels.net

________________________________
Von: Andreas Sewe <[email protected]>
Gesendet: Mittwoch, September 16, 2020 10:02 AM
An: [email protected]
Betreff: Re: Why does POM <configuration> have precedence over -D property 
expressions?

Andy Feldman wrote:
>> My situation is unfortunately a bit more complex than that, as I have
>> *two* <execution>s of the maven-enforcer-plugin, only one of which
>> should be affected by -DskipChecks. The other simply uses the
>> <requireMavenVersion> rule, which IMHO shouldn't easily be disabled (but
>> should still respect -Denforcer.skip)
>> [...]
>> What I want is this:
>> [...]
>
> -Denforcer.skip, being the more direct option, should
>> take precedence over -DskipChecks.
>
> Just an idea:
>
> <properties>
>   <enforcer.skip>false</enforcer.skip>
>   <skipChecks>${enforcer.skip}</skipChecks>
> </properties>
>
> This way if you set -DskipChecks=true, then only <id>checks</id> would be
> skipped, but if you set -Denforcer.skip=true, it would also cause
> skipChecks to be true, so both executions would be skipped. I haven't
> actually tested it though.

Thanks, Andy. The above does have the desired behavior *if* the
maven-enforcer-plugin were the only plugin which should be governed by
-DskipChecks.

But as I said in my initial mail, that property should also control the
maven-checkstyle-plugin, maven-tidy-plugin, and others (kine of like
-DskipTests does for maven-surefire-plugin and maven-failsafe-plugin).
And that's just not doable with

  <skipChecks>${enforcer.skip}</skipChecks>

I experimented quite a bit yesterday and have become convinced that the
desired behavior is not possible, at least without profiles (ugh!) --
and even then I am not sure, as the profile would need to affect only
some executions.

But maybe I am missing something.

Best wishes,

Andreas

Reply via email to