The default goal specifies extra targets. Currently it is:

clean verify apache-rat:check checkstyle:check pmd:check spotbugs:check
javadoc:javadoc

We could change the pom to bind these targets to a lifecycle phase [1] such
as 'verify'.

Looking at the pom for CM the checkstyle plugin is configured to use the
default goal of check. This binds to the 'verify' phase [2]. So the
'checkstyle:check' goal is redundant in the default goal. But apache-rat,
spotbugs and pmd are not configured with execution bindings.

However the site lifecycle is different to the default lifecycle used to
create and install artifacts. The site lifecycle is to build the project
documentation. It is not meant to run tests or build a jar package.
Somewhere in commons-parent or the pom for the project the site goal runs
tests due to a binding of a plugin for reporting. But it does not run the
verify phase so will miss checkstyle.

IIRC checkstyle was at one point run in the validate phase. This is early
in the default lifecycle. It meant you could not run 'mvn test' without
triggering checkstyle and so could not use System.out for dubugging. So it
was moved to verify. This was for Commons RNG but the configuration is
similar across all projects descended from Math.

Anyway the summary is that using 'mvn site' should not be expected to run
all the validation checks on the code. It is to build documentation. If you
want to check the code then use 'mvn verify'. The pom would have to be
updated to bind the other plugins from the default goal to this phase with
executions.

Alex


[1]
https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
[2] https://maven.apache.org/plugins/maven-checkstyle-plugin/check-mojo.html

On Wed, 14 Jul 2021 at 10:29, Gilles Sadowski <gillese...@gmail.com> wrote:

> Le mer. 14 juil. 2021 à 11:16, sebb <seb...@gmail.com> a écrit :
> >
> > On Wed, 14 Jul 2021 at 10:03, Gilles Sadowski <gillese...@gmail.com>
> wrote:
> > >
> > > Hi.
> > >
> > > Is it correct that
> > >   $ mvn site site:stage
> > > and
> > >   $ mvn
> > > behave differently (i.e. that the latter would not run "CheckStyle" or
> > > that it generates warnings instead of errors)?
> >
> > Depends on what the POM defines as the default target.
>
> Sure; but my question was whether the change of behaviour is
> deemed better (in some way which I've missed).  [IOW, why would
> the "mvn site site:stage" build would be allowed to succeed, while
> the default targets would make it fail?]
>
> >
> > > In CM, we were used to detect all issues by running the former.
> > > Is it expected that it's not the case anymore?
> > >
> > >
> > > Thanks,
> > > Gilles
> > >
> > > Le mer. 14 juil. 2021 à 01:01, Alex Herbert <alex.d.herb...@gmail.com>
> a écrit :
> > > >
> > > > On Tue, 13 Jul 2021 at 23:41, <er...@apache.org> wrote:
> > > >
> > > > > This is an automated email from the ASF dual-hosted git repository.
> > > > >
> > > > > erans pushed a commit to branch master
> > > > > in repository https://gitbox.apache.org/repos/asf/commons-math.git
> > > > >
> > > > >
> > > > > The following commit(s) were added to refs/heads/master by this
> push:
> > > > >      new 8f83827  Code simplifications (suggested by "sonarcloud").
> > > > > 8f83827 is described below
> > > > >
> > > > > commit 8f838278467c1d00ba3e9e83c4f9b963cf246984
> > > > > Author: Gilles Sadowski <gillese...@gmail.com>
> > > > > AuthorDate: Wed Jul 14 00:36:10 2021 +0200
> > > > >
> > > > >     Code simplifications (suggested by "sonarcloud").
> > > > > ---
> > > > >  .../nonlinear/scalar/noderiv/SimplexOptimizer.java | 31
> > > > > +++++-----------------
> > > > >  1 file changed, 7 insertions(+), 24 deletions(-)
> > > > >
> > > > > diff --git
> > > > >
> a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/SimplexOptimizer.java
> > > > >
> b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/SimplexOptimizer.java
> > > > > index e2fb510..60a2a38 100644
> > > > > ---
> > > > >
> a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/SimplexOptimizer.java
> > > > > +++
> > > > >
> b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/SimplexOptimizer.java
> > > > > @@ -123,27 +123,14 @@ public class SimplexOptimizer extends
> > > > > MultivariateOptimizer {
> > > > >
> > > > >          // Indirect call to "computeObjectiveValue" in order to
> update the
> > > > >          // evaluations counter.
> > > > > -        final MultivariateFunction evalFunc
> > > > > -            = new MultivariateFunction() {
> > > > > -                    /** {@inheritDoc} */
> > > > > -                    @Override
> > > > > -                    public double value(double[] point) {
> > > > > -                        return computeObjectiveValue(point);
> > > > > -                    }
> > > > > -                };
> > > > > +        final MultivariateFunction evalFunc = (p) ->
> > > > > computeObjectiveValue(p);
> > > > >
> > > >
> > > > Note you will get a checkstyle fail for using parentheses here.
> > > >
> > > > Can this be replaced with the method reference:
> > > >
> > > > final MultivariateFunction evalFunc = this::computeObjectiveValue;
> > > >
> > > > I've not checked the code so you may have to substitute this:: for a
> class
> > > > name if it is a static method.
> > > >
> > > > Alex
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> > > For additional commands, e-mail: dev-h...@commons.apache.org
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> > For additional commands, e-mail: dev-h...@commons.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
>
>

Reply via email to