Details
-
New Feature
-
Status: Open
-
Major
-
Resolution: Unresolved
-
2.15
-
None
-
None
-
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T13:57:37+02:00)
Maven home: /homes/jwienke/local/trusty/x86_64/opt/apache-maven-3.3.3
Java version: 1.8.0_05, vendor: Oracle Corporation
Java home: /vol/ai/java/versions/x64/jdk1.8.0_05/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.18.1-tf1-ll", arch: "amd64", family: "unix"Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T13:57:37+02:00) Maven home: /homes/jwienke/local/trusty/x86_64/opt/apache-maven-3.3.3 Java version: 1.8.0_05, vendor: Oracle Corporation Java home: /vol/ai/java/versions/x64/jdk1.8.0_05/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "3.18.1-tf1-ll", arch: "amd64", family: "unix"
Description
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