Howdy,

This most certainly cannot be an enforcer rule to "watch" some plugin
execution (as it may be too late).

But this reminds me of an "experiment" we were tinkering with:
https://github.com/apache/maven/pull/1086

Here the idea was to be able to instruct Maven (without tampering with
POM) to "skip" certain plugin executions. Now, instead of
filter/match/remove. something else can happen here, like:
- filter
- match
- some action, like "remove" (as in PR), but it could be prompt, and
if response is 'Y' NOT remove, etc
This is just to show the internal, I'd NOT recommend going this route.

Another (much simpler to implement) idea: an extension that inspect
the (effective) model, and collects plugin executions of interests and
does something.... ?
To inspect model here is an example:
https://github.com/sonatype/nexus-maven-plugins/blob/f5ba90d339064c4981716a98e4afa6a76bc3ff2e/staging/maven-plugin/src/main/java/org/sonatype/nexus/maven/staging/deploy/DeployLifecycleParticipant.java#L88
I'd advise to NOT modify the model (like remove the plugin), but instead:
- check model
- IF plugin/goal of interest detected, perform some action: prompt, yada
- basically fail the build if plugin would run, but user did not
provide "consent" for it

This could be a nice generic extension, where user of extension could
provide some configuration like:
G:A:goal = FAIL < fails the build if this plugin goal is detected to be executed
G:A:goal = APPROVE < makes a prompt, fail or continue the build
depending on user input
etc

My 5 cents

Thanks
T

On Thu, Aug 14, 2025 at 6:04 PM Andy Law <andy....@roslin.ed.ac.uk> wrote:
>
> I recognise that I may be over-reaching with my wish list, but any and all 
> constructive suggestions are welcomed.
>
> I have a project that uses liquibase to manage the database structure. I 
> store the connection credentials in profiles in my settings.xml file and have 
> an enforcer rule to ensure that one, and only one, of the develop, sandbox, 
> and production profiles is active when I run maven.
>
> I stash the liquibase changes in a sub-module of the project and only run the 
> plugin goals when needed. I would like to have the build/run plugin process 
> prompt me to confirm that I really mean to do what I’m trying to do if I run 
> the liquibase plugin with the production profile active.
>
> So:
>
>   *
> clean, install, validate, test etc. under normal circumstances, run with one 
> of the profiles active and don’t warn.
>   *
> run liquibase:update with the develop or sandbox profiles active - again, 
> don’t warn
>   *
> run liquibase:update with the production profile active - I want maven to ask 
> me to confirm that I really mean to do that.
>
>
> The liquibase plugin has a “promptOnNonLocalDatabase” option, but I can’t use 
> that because the connections to the database are tunnelled so they all appear 
> as local as far as the plugin process is concerned.
>
> I’m happy enough to hack together code to do this if there is no current 
> solution to the problem, but I’m not sure how I would go about tying 
> something like an enforcer rule to just the liquibase plugin executions.
>
> Does anyone think this is possible?
>
>
> Later,
>
>
>
> Andy
>
> --------
>
> Yada, yada, yada...
>
>
>
> Disclaimer: This e-mail and any attachments are confidential and intended 
> solely for the use of the recipient(s) to whom they are addressed. If you 
> have received it in error, please destroy all copies and inform the sender.
>
>
>
> The University of Edinburgh is a charitable body, registered in Scotland, 
> with registration number SC005336. Is e buidheann carthannais a th’ ann an 
> Oilthigh Dhùn Èideann, clàraichte an Alba, àireamh clàraidh SC005336.
>
>

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

Reply via email to