Have you considered only running the checkstyle goal, from the parent so it
processes all modules, before the full build goal(s)?


On Sun, Apr 21, 2024 at 9:27 AM <org.apache.maven.u...@io7m.com> wrote:

> Hello!
>
> I've been using the maven-checkstyle-plugin for many years now. Almost
> all of my projects are heavily multi-module, and I have a fairly
> traditional setup where a checkstyle plugin execution is defined in
> my organization-wide POM, and inherited by all modules in all projects.
> I run checkstyle in the process-sources phase and refuse to build
> code if there are style errors:
>
> https://github.com/io7m/primogenitor/blob/develop/pom.xml#L503
>
> This works well enough in the sense that I don't have to repeat any
> configuration information, and I can opt-out of checking on a per-module
> basis if necessary by setting checkstyle.skip in the module's properties.
>
> Where it _doesn't_ work well enough is that I really want to, for a
> given project, get all style errors in all modules before anything else
> in the build proceeds. I have projects where style checks succeed in
> module A, and then module B takes a minute or so to build, and then a
> style check fails in module C. I'd prefer to style check modules A, B,
> and C ahead of time so that I don't have to sit through a time-consuming
> build of B just to have C fail.
>
> There doesn't seem to be a nice way to configure this. Ideally I would
> want checkstyle to check all sources matching a given pattern
> ("*/src/main/java/**.java", probably). Even if I _could_ get the plugin
> to do this, it's not clear how I would preserve the ability to opt-out
> of checking on a per-module basis. I'm aware of the source-level
> comments like // CHECKSTYLE:OFF and so on, but I prefer to put this kind
> of thing in the POM.
>
> Anyone got any ideas?
>
> --
> Mark Raynsford | https://www.io7m.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>

Reply via email to