Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The Maven Checkstyle plugin doesn’t support printing the XML into the logs. Instead Configure Checkstyle in Maven first:

Code Block
languagexml
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-checkstyle-plugin</artifactId>
    <version>3.1.2</version>
    <executions>
        <execution>
            <id>validate</id>
            <phase>validate</phase>
            <goals>
                <goal>checkstyle</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Then print the generated target/checkstyle-result.xml file into the build log by a final task:

Code Block
#!/bin/bash
cat ./target/target/checkstyle-result.xml || echo "No Checkstyle analytics generated"

...