I'm looking for a generic solution to enable a Maven profile when a certain Maven goal is run. For example, if I run
mvn site
I also want to activate the profile reporting automatically. I don't want to do it manually, e.g., using:
mvn site -Preporting
I expected that in the activation part of a profile I can specify a Maven goal, triggering the profile to get enabled, but this doesn't seem the case.
Another idea was that I could somehow configure a property to get set if a certain goal is run, because a profile can be activated by a property. But I haven't really found a way how to do that.
Is there a generic solution?
site
a goal? I think it's a lifecycle ("site") and a lifecycle phase ("site"). (In your usage the latter.) You could hook your plugins onto the other site (lifecycle) phases, such aspre-site
andpost-site
. – Glissando