I am trying to introduce semi-automated checkstyle checker which would allow us to build html reports on projects without editing their pom files manualy each by each.
I am doing this in order to:
- improve and automate process of checking if Checkstyle version X.Y.Z (or just a specific check) works properly on exemplar huge opensource projects. I think even about adding such a check as part of our Travis build or etc in future.
- let any team having git repo on which Checkstyle fails for any reason provide us a prove link in a maximum simple manner. In ideal case anybody will be able to just put erroneous source to github, fork checkstyle-tester project and send us a link to it for farther investigation.
So I've written the script (
launch.sh) which clones several projects with git into src/main/java folder and launches
checkstyle-aggregate goal with fake pom file including expected Checkstyle and Sevntu-checkstyle versions as dependencies. Here is how I configure maven-checkstyle plugin in that pom file:
https://github.com/daniilyar/checkstyle-tester/blob/master/pom.xml#L18 (see line 18).
I am running goal checkstyle-aggregate (see line 36 at
https://github.com/daniilyar/checkstyle-tester/blob/master/launch.sh#L36) which, by
goal docs, should generate an html report.
Here is how I am running it:
./launch.sh -X
where -X parameter goes to Maven parameters list. Example launch debug log is below:
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-checkstyle-plugin:2.13:checkstyle-aggregate' with basic configurator -->
[DEBUG] (f) cacheFile = /home/dyaroslavtsev/Desktop/Code/checkstyle-tester/target/checkstyle-cachefile
[DEBUG] (f) configLocation = google_checks.xml
[DEBUG] (f) consoleOutput = false
[DEBUG] (f) enableFilesSummary = true
[DEBUG] (f) enableRSS = true
[DEBUG] (f) enableRulesSummary = true
[DEBUG] (f) enableSeveritySummary = true
[DEBUG] (f) encoding = UTF-8
[DEBUG] (f) failsOnError = false
[DEBUG] (f) headerLocation = LICENSE.txt
[DEBUG] (f) includeResources = true
[DEBUG] (f) includeTestResources = true
[DEBUG] (f) includeTestSourceDirectory = false
[DEBUG] (f) includes =
**\/*.java[DEBUG] (f) inputEncoding = UTF-8
[DEBUG] (f) linkXRef = true
[DEBUG] (f) mojoExecution = org.apache.maven.plugins:maven-checkstyle-plugin:2.13:checkstyle-aggregate {execution: default-cli}
[DEBUG] (f) outputDirectory = /home/dyaroslavtsev/Desktop/Code/checkstyle-tester/target/site
[DEBUG] (f) outputFile =
/home/dyaroslavtsev/Desktop/Code/checkstyle-tester/target/checkstyle-result.xml[DEBUG] (f) outputFileFormat = xml[DEBUG] (f) plugin = Component Descriptor: role: 'org.apache.maven.plugin.Mojo', implementation: 'org.apache.maven.plugin.checkstyle.CheckstyleReport', role hint: 'org.apache.maven.plugins:maven-checkstyle-plugin:2.13:checkstyle'
role: 'org.apache.maven.plugin.Mojo', implementation: 'org.apache.maven.plugin.checkstyle.CheckstyleViolationCheckMojo', role hint: 'org.apache.maven.plugins:maven-checkstyle-plugin:2.13:check'
role: 'org.apache.maven.plugin.Mojo', implementation: 'org.apache.maven.plugin.checkstyle.CheckstyleAggregateReport', role hint: 'org.apache.maven.plugins:maven-checkstyle-plugin:2.13:checkstyle-aggregate'
role: 'org.apache.maven.plugin.Mojo', implementation: 'org.apache.maven.plugin.checkstyle.HelpMojo', role hint: 'org.apache.maven.plugins:maven-checkstyle-plugin:2.13:help'
---
[DEBUG] (f) project = MavenProject: com.github.sevntu.checkstyle:sample:0.0.1-SNAPSHOT @ /home/dyaroslavtsev/Desktop/Code/checkstyle-tester/pom.xml
[DEBUG] (f) reactorProjects = [MavenProject: com.github.sevntu.checkstyle:sample:0.0.1-SNAPSHOT @ /home/dyaroslavtsev/Desktop/Code/checkstyle-tester/pom.xml]
[DEBUG] (f) resourceIncludes = **/*.properties
[DEBUG] (f) resources = [Resource {targetPath: null, filtering: false, FileSet {directory: /home/dyaroslavtsev/Desktop/Code/checkstyle-tester/src/main/resources, PatternSet [includes: {}, excludes: {}]}}]
[DEBUG] (f) skip = false
[DEBUG] (f) sourceDirectories = [/home/dyaroslavtsev/Desktop/Code/checkstyle-tester/src/main/java][DEBUG] (f) suppressionsFileExpression = checkstyle.suppressions.file
[DEBUG] (f) testResources = [Resource {targetPath: null, filtering: false, FileSet {directory: /home/dyaroslavtsev/Desktop/Code/checkstyle-tester/src/test/resources, PatternSet [includes: {}, excludes: {}]}}]
[DEBUG] (f) testSourceDirectories = [/home/dyaroslavtsev/Desktop/Code/checkstyle-tester/src/test/java]
[DEBUG] (f) xrefLocation = /home/dyaroslavtsev/Desktop/Code/checkstyle-tester/target/site/xref
[DEBUG] -- end configuration --
For some weird reason xml report is generated no matter that 'checkstyle-aggregate' goal docs says that it is a goal for generating HTML report.
Xml is not html so I am searching for truth and it seems that Maven Checkstyle Plugin docs are wrong and all goals at Maven Checkstyle Plugin could only produce XML reports.