checkstyle inside maven working, but not like in the documentation, so I can't figure out how to customize it

50 Views Asked by At

According to all the docs, to use the checkstyle:checkstyle goal for a maven run, you had to have set up all the dependencies and plugins in your pom file. Then you can not only USE that goal, but modify the pom to point to different configurations and such.

However, I can start a new maven project, use the "quickstart" archetype, and let it create the project... then just run maven with checkstyle:checkstyle as a goal.

Eclipse version

Eclipse IDE for Java Developers

Version: 2018-12 (4.10.0)
Build id: 20181214-0600

Here is the ENTIRE pom.xml file

<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>

  <groupId>fff</groupId>
  <artifactId>fff</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>fff</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>

The output of the maven run is:

[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------------< fff:fff >-------------------------------
[INFO] Building fff 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-checkstyle-plugin:3.3.0:checkstyle (default-cli) @ fff ---
[INFO] Rendering content with org.apache.maven.skins:maven-default-skin:jar:1.3 skin.
[INFO] There are 11 errors reported by Checkstyle 9.3 with sun_checks.xml ruleset.
[WARNING] Unable to locate Source XRef to link to - DISABLED
[WARNING] Unable to locate Test Source XRef to link to - DISABLED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.275 s
[INFO] Finished at: 2023-06-10T13:12:29-04:00
[INFO] ------------------------------------------------------------------------

So I can see that it's using maven-checkstyle-plugin:3.3.0 and Checkstyle 9.3 with sun_checks.xml ruleset.

However, I can't figure out how to apply all those pom.xml updates for configuration changes.

I want to learn how this set up is directing the maven plugin to use checkstyle and where it's keeping the settings for changing the configuration to run different style checks.

Am I just reading the wrong docs? Is there a different process now, for a built-in maven (maven2?)?

m2e - Maven Integration for Eclipse (includes Incubating components) 1.10.0.20181127-2120 org.eclipse.m2e.feature.feature.group Eclipse.org - m2e

0

There are 0 best solutions below