[MCHECKSTYLE-299] build type check goal ignored source options when using phases "test site"
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- java
- Domain
- build-system
Research direction
Reproduce the configuration with Maven using the commands listed, especially mvn test site, and inspect the effective configuration with mvn -X. Compare the sourceDirectories handling in the check goal against the deprecated sourceDirectory behavior; done means mvn test site checks only the configured source trees rather than all source trees.
Written by the indexing model from the issue text.
Description
Johannes Wienke opened MCHECKSTYLE-299 and commented
I have a project where we enforce a zero-warnings policy. For this purpose we have included a call to checkstyle:check in the build phase using the following configuration:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.15</version>
<configuration>
<configLocation>${project.basedir}/codecheck/checkstyle.xml</configLocation>
<propertyExpansion>config_loc=${project.basedir}/codecheck</propertyExpansion>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<consoleOutput>true</consoleOutput>
<violationSeverity>warning</violationSeverity>
<failOnViolation>true</failOnViolation>
<sourceDirectory>${project.basedir}/src</sourceDirectory>
</configuration>
<executions>
<execution>
<id>checkstyle-validate</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
Additionally, checkstyle is set up as a reporting goal in the reporting section:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.15</version>
<configuration>
<configLocation>${project.basedir}/codecheck/checkstyle.xml</configLocation>
<propertyExpansion>config_loc=${project.basedir}/codecheck</propertyExpansion>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<sourceDirectory>${project.basedir}/src</sourceDirectory>
</configuration>
</plugin>
The project contains multiple source trees and some contain generated code. Therefore it is necessary to restrict checkstyle to only one of these trees where the manually maintained code lives. Otherwise, the build would fail due to warnings being detected in generated code.
This shown configuration works well when calling maven all of the following ways:
mvn compile
mvn test
mvn site
mvn test site
However, when changing the deprecated sourceDirectory elements to the list syntax with sourceDirectories, the last call mvn test site starts to fail and ignores the specified source directories. All previous other calls still work as expected.
When looking at the effective configuration using mvn -X I could see, that in the last call version with "test site", the sourceDirectories list of the check goal is again the complete list of source trees instead of the specified one.
Since we are also using some plugins to include the generated code etc., a reference to the complete POM might be helpful for debugging:
https://code.cor-lab.org/projects/rsb/repository/rsb-java/revisions/master/entry/pom.xml
Affects: 2.15
- Dominant language
- Java
- Stars
- 97
- Forks
- 68
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 8
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/maven-checkstyle-plugin
-
maintenance
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
apache/maven-checkstyle-plugin#718 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 38/100
apache/maven-checkstyle-plugin#675 ·
Maintainers usually reply within 1 day
-
Update dependencies.May be free again A pull request for this issue was closed without being merged. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
apache/maven-checkstyle-plugin#664 ·
Maintainers usually reply within 1 day
-
DefaultCheckstyleExecutor should be a failure, not an errorPossibly taken @efegokdemir claimed this 26 days ago. Openbug
Difficulty 3/5 1-2 days Newbie friendliness 58/100
apache/maven-checkstyle-plugin#656 · 1 comment ·
Maintainers usually reply within 1 day
-
Add ability to print warnings when `failOnViolation: true` and `violationSeverity: error`Possibly taken @efegokdemir claimed this 24 days ago. Openenhancement
Difficulty 3/5 1-2 days Newbie friendliness 50/100
apache/maven-checkstyle-plugin#648 · 5 comments ·
Maintainers usually reply within 1 day
All issues in apache/maven-checkstyle-plugin
Similar issues
-
[Bug] dubbo.protocol.triple.max-message-size is only read from OS environment variablesPossibly taken @CCCLL claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
hierynomus/sshj#1070 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
intellij-elixir/intellij-elixir#4492 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
quarkiverse/quarkus-openapi-generator#1796 · 1 comment ·