Skip to content

Commit 89a7cdb

Browse files
committed
[MPMD-379] Upgrade to use PMD 7.0.0 by default (#144)
Merged pull request #144 from mkolesnikov:feature/MPMD-379_pmd_7
2 parents a3ac53c + f884af3 commit 89a7cdb

File tree

39 files changed

+382
-302
lines changed

39 files changed

+382
-302
lines changed

pom.xml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ under the License.
2828
</parent>
2929

3030
<artifactId>maven-pmd-plugin</artifactId>
31-
<version>3.21.3-SNAPSHOT</version>
31+
<version>3.22.0-SNAPSHOT</version>
3232
<packaging>maven-plugin</packaging>
3333

3434
<name>Apache Maven PMD Plugin</name>
@@ -83,7 +83,7 @@ under the License.
8383
<properties>
8484
<mavenVersion>3.2.5</mavenVersion>
8585
<javaVersion>8</javaVersion>
86-
<pmdVersion>6.55.0</pmdVersion>
86+
<pmdVersion>7.0.0</pmdVersion>
8787
<slf4jVersion>1.7.36</slf4jVersion>
8888
<aetherVersion>1.0.0.v20140518</aetherVersion>
8989
<doxiaVersion>1.12.0</doxiaVersion>
@@ -187,12 +187,6 @@ under the License.
187187
<artifactId>slf4j-api</artifactId>
188188
<version>${slf4jVersion}</version>
189189
</dependency>
190-
<!-- Support logging of PMD through slf4j. See also MPMD-244 -->
191-
<dependency>
192-
<groupId>org.slf4j</groupId>
193-
<artifactId>jul-to-slf4j</artifactId>
194-
<version>${slf4jVersion}</version>
195-
</dependency>
196190

197191
<!-- doxia -->
198192
<dependency>

src/it/MPMD-219-pmd-processing-error/verify.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@
2020
File buildLog = new File( basedir, 'build.log' )
2121
assert buildLog.exists()
2222
assert buildLog.text.contains( "PMD processing errors" )
23-
assert buildLog.text.contains( "Error while parsing" )
23+
assert buildLog.text.contains( "ParseException: Parse exception in file" )
2424
assert buildLog.text.contains( "BrokenFile.java" )

src/it/MPMD-243-excludeFromFailureFile/config/ruleset.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ under the License.
2626
MPMD-243
2727
</description>
2828

29-
<rule ref="rulesets/java/imports.xml/TooManyStaticImports"/>
29+
<rule ref="category/java/codestyle.xml/TooManyStaticImports"/>
3030
</ruleset>

src/it/MPMD-244-logging/logging-disabled/pom.xml

Lines changed: 0 additions & 61 deletions
This file was deleted.

src/it/MPMD-244-logging/logging-enabled/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ under the License.
4545
<version>@project.version@</version>
4646
<configuration>
4747
<skipPmdError>true</skipPmdError>
48-
<showPmdLog>true</showPmdLog>
4948
</configuration>
5049
<executions>
5150
<execution>

src/it/MPMD-244-logging/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ under the License.
3636
</properties>
3737

3838
<modules>
39-
<module>logging-disabled</module>
4039
<module>logging-enabled</module>
4140
</modules>
4241
</project>

src/it/MPMD-244-logging/verify.groovy

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@
2020
File buildLog = new File( basedir, 'build.log' )
2121
assert buildLog.exists()
2222
assert buildLog.text.contains( "PMD processing errors" )
23-
assert buildLog.text.contains( "Error while parsing" )
23+
assert buildLog.text.contains( "ParseException: Parse exception" )
24+
assert buildLog.text.contains( "at line 24, column 5: Encountered" )
2425

25-
String disabledPath = new File( basedir, 'logging-disabled/src/main/java/BrokenFile.java' ).getCanonicalPath()
2626
String enabledPath = new File( basedir, 'logging-enabled/src/main/java/BrokenFile.java' ).getCanonicalPath()
2727

28-
// logging disabled: the pmd exception is only output through the processing error reporting (since MPMD-246)
29-
assert 1 == buildLog.text.count( "net.sourceforge.pmd.PMDException: Error while parsing ${disabledPath}" )
30-
// logging enabled: the pmd exception is output twice: through the processing error reporting (since MPMD-246) and through PMD's own logging
31-
assert 2 == buildLog.text.count( "net.sourceforge.pmd.PMDException: Error while parsing ${enabledPath}" )
28+
// logging enabled: the pmd exception is still output only once: through the processing error reporting (since MPMD-246) - PMD 7 doesn't log the processing error additionally
29+
assert 1 == buildLog.text.count( "${enabledPath}: ParseException: Parse exception in" )
30+
31+
// build.log contains the logging from the two PMD executions
32+
// only one execution has logging enabled, so we expect only one log output
33+
assert 1 == buildLog.text.count( "[DEBUG] Rules loaded from" )
34+
// with --debug switch or -X the logging is always enabled and can't be disabled , because PMD 7 switched to slf4j

src/it/MPMD-258-multiple-executions/invoker.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18+
invoker.debug = true
1819
invoker.goals = clean compile pmd:pmd
1920
invoker.maven.version = 3.1.0+

src/it/MPMD-258-multiple-executions/verify.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ File buildLog = new File( basedir, 'build.log' )
2121
assert buildLog.exists()
2222

2323
// we have 2 modules and for each module this should be output once
24+
// note: this is only logged in debug mode by net.sourceforge.pmd.cache.FileAnalysisCache
2425
assert 2 == buildLog.text.count( "Analysis cache created" )
2526

2627
// since we are running clean pmd:pmd, the cache is always created, never updated
28+
// note: this is only logged in debug mode by net.sourceforge.pmd.cache.FileAnalysisCache
2729
assert 0 == buildLog.text.count( "Analysis cache updated" )

src/it/MPMD-268-deprecated-rules/verify.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@
1919

2020
File buildLog = new File( basedir, 'build.log' )
2121
assert buildLog.exists()
22-
assert buildLog.text.contains( "[WARNING] Use Rule name category/java/codestyle.xml/ControlStatementBraces instead of the deprecated" )
22+
assert buildLog.text.contains( "Use Rule name category/java/codestyle.xml/ControlStatementBraces instead of the deprecated Rule name" )

0 commit comments

Comments
 (0)