somehow the checkstyle
goal is not fired it the tasks where I've set to be run.
this is my POM
:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
...
<version>1.0-SNAPSHOT</version>
<name>...</name>
<!-- FIXME change it to the project's website -->
<url>http://www.idk.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<configuration>
<failsOnError>true</failsOnError>
<configLocation>checkstyle.xml</configLocation>
<consoleOutput>true</consoleOutput>
</configuration>
<executions>
<execution>
<id>build</id>
<phase>build</phase>
<goals>
<goal>checkstyle</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<phase>verify</phase>
<goals>
<goal>checkstyle</goal>
</goals>
</execution>
<execution>
<id>package</id>
<phase>package</phase>
<goals>
<goal>checkstyle</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
but if i run mvn verify
i don't see the checkstyle
been run:
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< ... >-----------------
[INFO] Building Icecream Shop Manager 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ ... ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory ...
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ ... ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to ...
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ ... ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory ...
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ ... ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to ...
[INFO]
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ ... ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running it.unipd.tos.AppTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.047 s - in it.unipd.tos.AppTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-jar-plugin:3.0.2:jar (default-jar) @ ... ---
[INFO] Building jar: ...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.423 s
[INFO] Finished at: 2020-11-24T22:19:44+01:00
[INFO] ------------------------------------------------------------------------
what am I missing? shouldn't I see something like:
[INFO] --- maven-checkstyle-plugin:2.17:checkstyle (default) @ ... ---
The
<pluginManagement>
element is used to configure plugins to be inherited. You need to place your Checkstyle Plugin definition under the<plugins>
element, not under the<pluginManagement>
element.