You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Elliotte Rusty Harold <el...@ibiblio.org> on 2019/03/20 15:42:47 UTC

Maven enforcer rules with access to current project

Yesterday one of our developers uncovered a major architectural flaw
in one of our projects. Before we back up and do something different I
want to make sure our current thoughts are accurate.

As best we can tell it seems that Maven enforcer rules cannot read the
code from the current project (the one whose pom.xml includes the
enforcer rule) because enforcer rules execute in the validation phase
before the project is compiled.

Is this accurate or is there some way we could execute the enforcer
rule in the verify phase instead? Or somehow have access to the
current compiled source code from the validate phase?

If not, we're probably going to have to rewrite our enforcer rule as
an independent maven plugin.

-- 
Elliotte Rusty Harold
elharo@ibiblio.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Maven enforcer rules with access to current project

Posted by Stephen Connolly <st...@gmail.com>.
You can change the phase the execution is bound to to put it in the
process-classes phase if your rule needs to validate the classes

On Wed, 20 Mar 2019 at 15:43, Elliotte Rusty Harold <el...@ibiblio.org>
wrote:

> Yesterday one of our developers uncovered a major architectural flaw
> in one of our projects. Before we back up and do something different I
> want to make sure our current thoughts are accurate.
>
> As best we can tell it seems that Maven enforcer rules cannot read the
> code from the current project (the one whose pom.xml includes the
> enforcer rule) because enforcer rules execute in the validation phase
> before the project is compiled.
>
> Is this accurate or is there some way we could execute the enforcer
> rule in the verify phase instead? Or somehow have access to the
> current compiled source code from the validate phase?
>
> If not, we're probably going to have to rewrite our enforcer rule as
> an independent maven plugin.
>
> --
> Elliotte Rusty Harold
> elharo@ibiblio.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>