Description:
After upgrading used PMD version from 5.6.1 to 5.8.1, Maven PMD plugin fails with no specific reason except Failed to process.... Furthermore, there is no PMD report or other file that indicates what is wrong.
$ mvn -X -Dpmd.verbose=true clean install
Maven home: /home/lyor/Software/apache-maven-3.5.0
Java version: 1.8.0_91, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.91-2.b14.fc22.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.4.14-200.fc22.x86_64", arch: "amd64", family: "unix"
.....
......
[INFO] --- maven-pmd-plugin:3.8:pmd (pmd) @ cb4-common-util ---
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=1, ConflictMarker.markTime=0, ConflictMarker.nodeCount=280, ConflictIdSorter.graphTime=0, ConflictIdSorter.topsortTime=0, ConflictIdSorter.conflictIdCount=70, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=2, ConflictResolver.conflictItemCount=152, DefaultDependencyCollector.collectTime=38, DefaultDependencyCollector.transformTime=3}
[DEBUG] org.apache.maven.plugins:maven-pmd-plugin:jar:3.8:
[DEBUG] net.sourceforge.pmd:pmd-core:jar:5.8.1:runtime
[DEBUG] com.beust:jcommander:jar:1.48:runtime
[DEBUG] jaxen:jaxen:jar:1.1.6:runtime
[DEBUG] net.java.dev.javacc:javacc:jar:5.0:runtime
[DEBUG] net.sourceforge.saxon:saxon:jar:9.1.0.8:runtime
[DEBUG] org.apache.commons:commons-lang3:jar:3.4:runtime
[DEBUG] org.ow2.asm:asm:jar:5.0.4:runtime
[DEBUG] com.google.code.gson:gson:jar:2.5:runtime
[DEBUG] net.sourceforge.saxon:saxon:jar:dom:9.1.0.8:runtime
[DEBUG] net.sourceforge.pmd:pmd-java:jar:5.8.1:runtime
[DEBUG] net.sourceforge.pmd:pmd-javascript:jar:5.8.1:runtime
[DEBUG] org.mozilla:rhino:jar:1.7.7:runtime
[DEBUG] net.sourceforge.pmd:pmd-jsp:jar:5.8.1:runtime
[DEBUG] org.apache.maven:maven-artifact:jar:2.2.1:compile
[DEBUG] org.apache.maven:maven-model:jar:2.2.1:compile
[DEBUG] org.apache.maven:maven-plugin-api:jar:2.2.1:compile
[DEBUG] org.apache.maven:maven-project:jar:2.2.1:compile
[DEBUG] org.apache.maven:maven-settings:jar:2.2.1:compile
[DEBUG] org.apache.maven:maven-profile:jar:2.2.1:compile
[DEBUG] org.apache.maven:maven-artifact-manager:jar:2.2.1:compile
[DEBUG] org.apache.maven:maven-repository-metadata:jar:2.2.1:compile
[DEBUG] backport-util-concurrent:backport-util-concurrent:jar:3.1:compile
[DEBUG] org.apache.maven:maven-plugin-registry:jar:2.2.1:compile
[DEBUG] org.codehaus.plexus:plexus-interpolation:jar:1.11:compile
[DEBUG] org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
[DEBUG] junit:junit:jar:3.8.1:compile
[DEBUG] classworlds:classworlds:jar:1.1-alpha-2:compile
[DEBUG] org.apache.maven.doxia:doxia-sink-api:jar:1.4:compile
[DEBUG] org.apache.maven.doxia:doxia-logging-api:jar:1.4:compile
[DEBUG] org.apache.maven.doxia:doxia-decoration-model:jar:1.4:compile
[DEBUG] org.codehaus.plexus:plexus-component-annotations:jar:1.6:compile
[DEBUG] org.apache.maven.doxia:doxia-site-renderer:jar:1.4:compile
[DEBUG] org.apache.maven.doxia:doxia-core:jar:1.4:compile
[DEBUG] xerces:xercesImpl:jar:2.9.1:compile
[DEBUG] commons-lang:commons-lang:jar:2.4:compile
[DEBUG] org.apache.maven.doxia:doxia-module-xhtml:jar:1.4:compile
[DEBUG] org.apache.maven.doxia:doxia-module-fml:jar:1.4:compile
[DEBUG] org.codehaus.plexus:plexus-i18n:jar:1.0-beta-7:compile
[DEBUG] org.codehaus.plexus:plexus-velocity:jar:1.1.7:compile
[DEBUG] org.apache.velocity:velocity:jar:1.5:compile
[DEBUG] oro:oro:jar:2.0.8:compile
[DEBUG] org.apache.velocity:velocity-tools:jar:2.0:compile
[DEBUG] commons-beanutils:commons-beanutils:jar:1.7.0:compile
[DEBUG] commons-digester:commons-digester:jar:1.8:compile
[DEBUG] commons-chain:commons-chain:jar:1.1:compile
[DEBUG] sslext:sslext:jar:1.2-0:compile
[DEBUG] org.apache.struts:struts-core:jar:1.3.8:compile
[DEBUG] antlr:antlr:jar:2.7.2:compile
[DEBUG] org.apache.struts:struts-taglib:jar:1.3.8:compile
[DEBUG] org.apache.struts:struts-tiles:jar:1.3.8:compile
[DEBUG] commons-collections:commons-collections:jar:3.2.1:compile
[DEBUG] org.apache.maven.reporting:maven-reporting-api:jar:3.0:compile
[DEBUG] org.apache.maven.reporting:maven-reporting-impl:jar:2.3:compile
[DEBUG] org.apache.maven.shared:maven-shared-utils:jar:0.6:compile
[DEBUG] com.google.code.findbugs:jsr305:jar:2.0.1:compile
[DEBUG] commons-validator:commons-validator:jar:1.3.1:compile
[DEBUG] org.codehaus.plexus:plexus-resources:jar:1.0.1:compile
[DEBUG] org.codehaus.plexus:plexus-utils:jar:3.0.24:compile
[DEBUG] org.apache.httpcomponents:httpclient:jar:4.3.5:compile
[DEBUG] org.apache.httpcomponents:httpcore:jar:4.3.2:compile
[DEBUG] commons-logging:commons-logging:jar:1.1.3:compile
[DEBUG] commons-codec:commons-codec:jar:1.6:compile
[DEBUG] commons-io:commons-io:jar:2.5:compile
[DEBUG] Created new class realm plugin>org.apache.maven.plugins:maven-pmd-plugin:3.8
[DEBUG] Importing foreign packages into class realm plugin>org.apache.maven.plugins:maven-pmd-plugin:3.8
[DEBUG] Imported: < maven.api
[DEBUG] Populating class realm plugin>org.apache.maven.plugins:maven-pmd-plugin:3.8
[DEBUG] Included: org.apache.maven.plugins:maven-pmd-plugin:jar:3.8
[DEBUG] Included: net.sourceforge.pmd:pmd-core:jar:5.8.1
[DEBUG] Included: com.beust:jcommander:jar:1.48
[DEBUG] Included: jaxen:jaxen:jar:1.1.6
[DEBUG] Included: net.java.dev.javacc:javacc:jar:5.0
[DEBUG] Included: net.sourceforge.saxon:saxon:jar:9.1.0.8
[DEBUG] Included: org.apache.commons:commons-lang3:jar:3.4
[DEBUG] Included: org.ow2.asm:asm:jar:5.0.4
[DEBUG] Included: com.google.code.gson:gson:jar:2.5
[DEBUG] Included: net.sourceforge.saxon:saxon:jar:dom:9.1.0.8
[DEBUG] Included: net.sourceforge.pmd:pmd-java:jar:5.8.1
[DEBUG] Included: net.sourceforge.pmd:pmd-javascript:jar:5.8.1
[DEBUG] Included: org.mozilla:rhino:jar:1.7.7
[DEBUG] Included: net.sourceforge.pmd:pmd-jsp:jar:5.8.1
[DEBUG] Included: backport-util-concurrent:backport-util-concurrent:jar:3.1
[DEBUG] Included: org.codehaus.plexus:plexus-interpolation:jar:1.11
[DEBUG] Included: junit:junit:jar:3.8.1
[DEBUG] Included: org.apache.maven.doxia:doxia-sink-api:jar:1.4
[DEBUG] Included: org.apache.maven.doxia:doxia-logging-api:jar:1.4
[DEBUG] Included: org.apache.maven.doxia:doxia-decoration-model:jar:1.4
[DEBUG] Included: org.codehaus.plexus:plexus-component-annotations:jar:1.6
[DEBUG] Included: org.apache.maven.doxia:doxia-site-renderer:jar:1.4
[DEBUG] Included: org.apache.maven.doxia:doxia-core:jar:1.4
[DEBUG] Included: xerces:xercesImpl:jar:2.9.1
[DEBUG] Included: commons-lang:commons-lang:jar:2.4
[DEBUG] Included: org.apache.maven.doxia:doxia-module-xhtml:jar:1.4
[DEBUG] Included: org.apache.maven.doxia:doxia-module-fml:jar:1.4
[DEBUG] Included: org.codehaus.plexus:plexus-i18n:jar:1.0-beta-7
[DEBUG] Included: org.codehaus.plexus:plexus-velocity:jar:1.1.7
[DEBUG] Included: org.apache.velocity:velocity:jar:1.5
[DEBUG] Included: oro:oro:jar:2.0.8
[DEBUG] Included: org.apache.velocity:velocity-tools:jar:2.0
[DEBUG] Included: commons-beanutils:commons-beanutils:jar:1.7.0
[DEBUG] Included: commons-digester:commons-digester:jar:1.8
[DEBUG] Included: commons-chain:commons-chain:jar:1.1
[DEBUG] Included: sslext:sslext:jar:1.2-0
[DEBUG] Included: org.apache.struts:struts-core:jar:1.3.8
[DEBUG] Included: antlr:antlr:jar:2.7.2
[DEBUG] Included: org.apache.struts:struts-taglib:jar:1.3.8
[DEBUG] Included: org.apache.struts:struts-tiles:jar:1.3.8
[DEBUG] Included: commons-collections:commons-collections:jar:3.2.1
[DEBUG] Included: org.apache.maven.reporting:maven-reporting-api:jar:3.0
[DEBUG] Included: org.apache.maven.reporting:maven-reporting-impl:jar:2.3
[DEBUG] Included: org.apache.maven.shared:maven-shared-utils:jar:0.6
[DEBUG] Included: com.google.code.findbugs:jsr305:jar:2.0.1
[DEBUG] Included: commons-validator:commons-validator:jar:1.3.1
[DEBUG] Included: org.codehaus.plexus:plexus-resources:jar:1.0.1
[DEBUG] Included: org.codehaus.plexus:plexus-utils:jar:3.0.24
[DEBUG] Included: org.apache.httpcomponents:httpclient:jar:4.3.5
[DEBUG] Included: org.apache.httpcomponents:httpcore:jar:4.3.2
[DEBUG] Included: commons-logging:commons-logging:jar:1.1.3
[DEBUG] Included: commons-codec:commons-codec:jar:1.6
[DEBUG] Included: commons-io:commons-io:jar:2.5
[DEBUG] Configuring mojo org.apache.maven.plugins:maven-pmd-plugin:3.8:pmd from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-pmd-plugin:3.8, parent: sun.misc.Launcher$AppClassLoader@70dea4e]
[DEBUG] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[DEBUG] Setting property: site.resource.loader.class => 'org.codehaus.plexus.velocity.SiteResourceLoader'.
[DEBUG] Setting property: velocimacro.messages.on => 'false'.
[DEBUG] Setting property: resource.loader => 'classpath,site'.
[DEBUG] Setting property: runtime.log.invalid.references => 'false'.
[DEBUG] Setting property: resource.manager.logwhenfound => 'false'.
[DEBUG] Setting property: velocimacro.permissions.allow.inline.to.replace.global => 'true'.
[DEBUG] *******************************************************************
[DEBUG] Starting Apache Velocity v1.5 (compiled: 2007-02-22 08:52:29)
[DEBUG] RuntimeInstance initializing.
[DEBUG] Default Properties File: org/apache/velocity/runtime/defaults/velocity.properties
[DEBUG] LogSystem has been deprecated. Please use a LogChute implementation.
[DEBUG] Default ResourceManager initializing. (class org.apache.velocity.runtime.resource.ResourceManagerImpl)
[DEBUG] ResourceLoader instantiated: org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader
[DEBUG] ResourceLoader instantiated: org.codehaus.plexus.velocity.SiteResourceLoader
[DEBUG] ResourceCache: initialized (class org.apache.velocity.runtime.resource.ResourceCacheImpl)
[DEBUG] Default ResourceManager initialization complete.
[DEBUG] Loaded System Directive: org.apache.velocity.runtime.directive.Literal
[DEBUG] Loaded System Directive: org.apache.velocity.runtime.directive.Macro
[DEBUG] Loaded System Directive: org.apache.velocity.runtime.directive.Parse
[DEBUG] Loaded System Directive: org.apache.velocity.runtime.directive.Include
[DEBUG] Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
[DEBUG] Created '20' parsers.
[DEBUG] Velocimacro : initialization starting.
[DEBUG] Velocimacro : allowInline = true : VMs can be defined inline in templates
[DEBUG] Velocimacro : allowInlineToOverride = true : VMs defined inline may replace previous VM definitions
[DEBUG] Velocimacro : allowInlineLocal = false : VMs defined inline will be global in scope if allowed.
[DEBUG] Velocimacro : autoload off : VM system will not automatically reload global library macros
[DEBUG] Velocimacro : Velocimacro : initialization complete.
[DEBUG] RuntimeInstance successfully initialized.
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-pmd-plugin:3.8:pmd' with basic configurator -->
[DEBUG] (f) aggregate = false
[DEBUG] (f) analysisCache = false
[DEBUG] (f) analysisCacheLocation = /home/lyor/workspace/C-B4-Server/commons/cb4-common-util/target/pmd/pmd.cache
[DEBUG] (f) benchmark = false
[DEBUG] (f) benchmarkOutputFilename = /home/lyor/workspace/C-B4-Server/commons/cb4-common-util/target/pmd-benchmark.txt
[DEBUG] (f) compileSourceRoots = [/home/lyor/workspace/C-B4-Server/commons/cb4-common-util/src/main/java, /home/lyor/workspace/C-B4-Server/commons/cb4-common-util/target/generated-sources/annotations]
[DEBUG] (f) excludeRoots = [/home/lyor/workspace/C-B4-Server/commons/cb4-common-util/target/generated-sources/java]
[DEBUG] (f) format = xml
[DEBUG] (f) includeTests = true
[DEBUG] (f) includeXmlInSite = false
[DEBUG] (f) inputEncoding = UTF-8
[DEBUG] (f) language = java
[DEBUG] (f) linkXRef = true
[DEBUG] (f) minimumPriority = 5
[DEBUG] (f) outputDirectory = /home/lyor/workspace/C-B4-Server/commons/cb4-common-util/target/site
[DEBUG] (f) outputEncoding = UTF-8
[DEBUG] (f) project = MavenProject: com.cb4.commons:cb4-common-util:3.2.19-SNAPSHOT @ /home/lyor/workspace/C-B4-Server/commons/cb4-common-util/pom.xml
[DEBUG] (f) reactorProjects = [MavenProject: com.cb4.commons:cb4-common-util:3.2.19-SNAPSHOT @ /home/lyor/workspace/C-B4-Server/commons/cb4-common-util/pom.xml]
[DEBUG] (s) rulesets = [file:/home/lyor/workspace/C-B4-Server/pmd-ruleset-cb4.xml]
[DEBUG] (f) skip = false
[DEBUG] (f) skipEmptyReport = true
[DEBUG] (f) skipPmdError = false
[DEBUG] (f) sourceEncoding = UTF-8
[DEBUG] (f) targetDirectory = /home/lyor/workspace/C-B4-Server/commons/cb4-common-util/target
[DEBUG] (f) targetJdk = 1.8
[DEBUG] (f) testSourceRoots = [/home/lyor/workspace/C-B4-Server/commons/cb4-common-util/src/test/java, /home/lyor/workspace/C-B4-Server/commons/cb4-common-util/target/generated-test-sources/test-annotations]
[DEBUG] (f) typeResolution = true
[DEBUG] (f) xrefLocation = /home/lyor/workspace/C-B4-Server/commons/cb4-common-util/target/site/xref
[DEBUG] (f) xrefTestLocation = /home/lyor/workspace/C-B4-Server/commons/cb4-common-util/target/site/xref-test
[DEBUG] -- end configuration --
[DEBUG] Using language LanguageModule:Java(JavaLanguageModule)+version:1.8
[DEBUG] Using aux classpath: [/home/lyor/workspace/C-B4-Server/commons/cb4-common-util/target/test-classes, /home/lyor/workspace/C-B4-Server/commons/cb4-common-util/target/classes, /home/lyor/.m2/repository/org/apache/commons/commons-lang3/3.6/commons-lang3-3.6.jar, /home/lyor/.m2/repository/org/apache/commons/commons-text/1.1/commons-text-1.1.jar, /home/lyor/.m2/repository/org/apache/commons/commons-math3/3.6.1/commons-math3-3.6.1.jar, /home/lyor/.m2/repository/commons-io/commons-io/2.5/commons-io-2.5.jar, /home/lyor/.m2/repository/commons-cli/commons-cli/1.4/commons-cli-1.4.jar, /home/lyor/.m2/repository/commons-codec/commons-codec/1.10/commons-codec-1.10.jar, /home/lyor/.m2/repository/org/apache/commons/commons-collections4/4.1/commons-collections4-4.1.jar, /home/lyor/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.25/jcl-over-slf4j-1.7.25.jar, /home/lyor/.m2/repository/com/opencsv/opencsv/3.10/opencsv-3.10.jar, /home/lyor/.m2/repository/commons-beanutils/commons-beanutils/1.9.3/commons-beanutils-1.9.3.jar, /home/lyor/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar, /home/lyor/.m2/repository/com/univocity/univocity-parsers/2.5.6/univocity-parsers-2.5.6.jar, /home/lyor/.m2/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-csv/2.9.1/jackson-dataformat-csv-2.9.1.jar, /home/lyor/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.9.1/jackson-annotations-2.9.1.jar, /home/lyor/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.9.1/jackson-core-2.9.1.jar, /home/lyor/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.9.1/jackson-databind-2.9.1.jar, /home/lyor/.m2/repository/com/google/guava/guava/19.0/guava-19.0.jar, /home/lyor/.m2/repository/org/slf4j/jul-to-slf4j/1.7.25/jul-to-slf4j-1.7.25.jar, /home/lyor/.m2/repository/org/slf4j/slf4j-simple/1.7.25/slf4j-simple-1.7.25.jar, /home/lyor/.m2/repository/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar, /home/lyor/.m2/repository/junit/junit/4.12/junit-4.12.jar, /home/lyor/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar, /home/lyor/.m2/repository/org/mockito/mockito-all/1.10.19/mockito-all-1.10.19.jar]
[DEBUG] Preparing ruleset: file:/home/lyor/workspace/C-B4-Server/pmd-ruleset-cb4.xml
[DEBUG] Before: file:/home/lyor/workspace/C-B4-Server/pmd-ruleset-cb4.xml After: pmd-ruleset-cb4.xml
[DEBUG] URLResourceLoader: Found 'file:/home/lyor/workspace/C-B4-Server/pmd-ruleset-cb4.xml' at ''
[DEBUG] The resource 'file:/home/lyor/workspace/C-B4-Server/pmd-ruleset-cb4.xml' was found as file:/home/lyor/workspace/C-B4-Server/pmd-ruleset-cb4.xml.
[DEBUG] Exclusions: **/*~,**/#*#,**/.#*,**/%*%,**/._*,**/CVS,**/CVS/**,**/.cvsignore,**/RCS,**/RCS/**,**/SCCS,**/SCCS/**,**/vssver.scc,**/project.pj,**/.svn,**/.svn/**,**/.arch-ids,**/.arch-ids/**,**/.bzr,**/.bzr/**,**/.MySCMServerInfo,**/.DS_Store,**/.metadata,**/.metadata/**,**/.hg,**/.hgignore,**/.hg/**,**/.git,**/.gitignore,**/.gitattributes,**/.git/**,**/BitKeeper,**/BitKeeper/**,**/ChangeSet,**/ChangeSet/**,**/_darcs,**/_darcs/**,**/.darcsrepo,**/.darcsrepo/**,**/-darcs-backup*,**/.darcs-temp-mail
[DEBUG] Inclusions: **/*.java
[DEBUG] Searching for files in directory /home/lyor/workspace/C-B4-Server/commons/cb4-common-util/src/main/java
[DEBUG] Searching for files in directory /home/lyor/workspace/C-B4-Server/commons/cb4-common-util/target/generated-sources/annotations
[DEBUG] Searching for files in directory /home/lyor/workspace/C-B4-Server/commons/cb4-common-util/src/test/java
[DEBUG] Searching for files in directory /home/lyor/workspace/C-B4-Server/commons/cb4-common-util/target/generated-test-sources/test-annotations
[DEBUG] Executing PMD...
[DEBUG] PMD finished. Found 0 violations.
[ERROR] PMD processing errors:
[ERROR] /home/lyor/workspace/C-B4-Server/commons/cb4-common-util/src/test/java/com/cb4/common/utils/MapUtilsTest.java: Error while processing /home/lyor/workspace/C-B4-Server/commons/cb4-common-util/src/test/java/com/cb4/common/utils/MapUtilsTest.java
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 37.248 s
[INFO] Finished at: 2017-09-24T12:30:52+03:00
[INFO] Final Memory: 64M/1305M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-pmd-plugin:3.8:pmd (pmd) on project cb4-common-util: Execution pmd of goal org.apache.maven.plugins:maven-pmd-plugin:3.8:pmd failed: org.apache.maven.reporting.MavenReportException: Found 1 PMD processing errors -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-pmd-plugin:3.8:pmd (pmd) on project cb4-common-util: Execution pmd of goal org.apache.maven.plugins:maven-pmd-plugin:3.8:pmd failed: org.apache.maven.reporting.MavenReportException: Found 1 PMD processing errors
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions(MojoExecutor.java:353)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:198)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution pmd of goal org.apache.maven.plugins:maven-pmd-plugin:3.8:pmd failed: org.apache.maven.reporting.MavenReportException: Found 1 PMD processing errors
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 24 more
Caused by: java.lang.RuntimeException: org.apache.maven.reporting.MavenReportException: Found 1 PMD processing errors
at org.apache.maven.plugin.pmd.PmdReport.canGenerateReport(PmdReport.java:298)
at org.apache.maven.reporting.AbstractMavenReport.execute(AbstractMavenReport.java:119)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
... 25 more
Caused by: org.apache.maven.reporting.MavenReportException: Found 1 PMD processing errors
at org.apache.maven.plugin.pmd.PmdReport.executePmd(PmdReport.java:420)
at org.apache.maven.plugin.pmd.PmdReport.executePmdWithClassloader(PmdReport.java:311)
at org.apache.maven.plugin.pmd.PmdReport.canGenerateReport(PmdReport.java:285)
... 27 more
P.S. The file that it complains about (see code sample below) passes without a problem for version 5.6.1.. I initially opened MPMD-244 Maven issue but they advised me that it seems to be a PMD issue
package com.cb4.common.utils; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.Date; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.NavigableMap; import java.util.Objects; import java.util.Properties; import java.util.Random; import java.util.TreeMap; import java.util.function.Predicate; import org.apache.commons.collections4.Transformer; import org.apache.commons.lang3.math.NumberUtils; import org.apache.commons.lang3.tuple.Pair; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import com.cb4.common.test.JUnitTestSupport; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class MapUtilsTest extends JUnitTestSupport { public MapUtilsTest() { super(); } @Test public void testPutUniqueValuesForNoSource() { @SuppressWarnings("unchecked") Map<Object, Object>[] maps = new Map[] { null, Collections.emptyMap() }; for (Map<Object, Object> dst : maps) { for (Map<?, ?> src : maps) { assertSame("Mismatched result for src=" + src + ", dst=" + dst, dst, MapUtils.putUniqueValues(src, dst)); } } } @Test(expected = IllegalStateException.class) public void testPutUniqueValuesWithDuplicates() { Map<Object, Object> dst = new HashMap<>(Collections.singletonMap("test", getCurrentTestName())); assertSame("Mismatched result for self update", dst, MapUtils.putUniqueValues(dst, dst)); for (Map.Entry<?, ?> de : dst.entrySet()) { Map<?, ?> result = MapUtils.putUniqueValues(Collections.singletonMap(de.getKey(), de.getValue()), dst); fail("Unexpected success for entry=" + de + ": " + result); } } @Test public void testPutUniqueValues() { final Class<?> anchor = getClass(); Map<String, String> extra = new TreeMap<String, String>() { // Not serializing it private static final long serialVersionUID = 1L; { put("class", anchor.getSimpleName()); put("package", anchor.getPackage().getName()); put("test", getCurrentTestName()); } }; Map<String, String> original = Collections.singletonMap("now", new Date().toString()); Map<String, String> dest = new HashMap<>(original); // NOTE: we use a hash map on purpose so we get a map with different keys order than original Map<String, String> merged = MapUtils.putUniqueValues(extra, dest); assertSame("Not same destination result", dest, merged); assertEquals("Mismatched merged size", extra.size() + original.size(), merged.size()); for (@SuppressWarnings("unchecked") Map<String, String> m : new Map[] { original, extra }) { for (Map.Entry<String, String> me : m.entrySet()) { String key = me.getKey(); String expected = me.getValue(); String actual = merged.get(key); assertEquals("Mismatched merged result for key=" + key, expected, actual); } } } @Test public void testSort() { Map<Integer, String> map = new HashMap<>(); map.put(5, "aa"); map.put(1, "ss"); map.put(3, "ww"); Map<Integer, String> actualMap = MapUtils.sort(map); Map<Integer, String> expectedMap = new LinkedHashMap<>(); expectedMap.put(1, "ss"); expectedMap.put(3, "ww"); expectedMap.put(5, "aa"); assertEquals(expectedMap, actualMap); } @Test public void testAddValuesToMap() { Map<Integer, ArrayList<String>> map = new HashMap<>(); MapUtils.addValueToMapList(map, 5, "aa"); assertTrue("Missing '5' key", map.containsKey(5)); assertTrue("Missing 'aa' sub-key", map.get(5).contains("aa")); MapUtils.addValueToMapList(map, 5, "bb"); assertTrue("Missing 2nd 'aa' sub-key", map.get(5).contains("aa")); assertTrue("Missing 'bb' sub-key", map.get(5).contains("bb")); MapUtils.addValueToMapList(map, 1, "aa"); assertTrue("Missing 'aa' sub-key of '1'", map.get(1).contains("aa")); } @Test public void testSortKeys() { Map<Integer, String> map = new HashMap<>(); map.put(5, "aa"); map.put(1, "ss"); map.put(3, "ww"); Map<Integer, String> actualMap = MapUtils.sort(map); Map<Integer, String> expectedMap = new LinkedHashMap<>(); expectedMap.put(1, "ss"); expectedMap.put(3, "ww"); expectedMap.put(5, "aa"); assertEquals(expectedMap, actualMap); } @Test public void testValuesSort() { Map<Integer, String> map = new HashMap<>(); map.put(5, "aa"); map.put(1, "ss"); map.put(3, "ww"); Map<Integer, String> actualMap = MapUtils.sort(map); Map<Integer, String> expectedMap = new LinkedHashMap<>(); expectedMap.put(5, "aa"); expectedMap.put(1, "ss"); expectedMap.put(3, "ww"); assertEquals(expectedMap, actualMap); } @Test public void testRandomSortByValue() { Random random = new Random(System.currentTimeMillis()); Map<String, Integer> testMap = new HashMap<>(1000); for (int i = 0; i < 1000; ++i) { testMap.put("SomeString" + random.nextInt(), random.nextInt()); } testMap = MapUtils.sortByValues(testMap); assertEquals(1000, testMap.size()); Integer previous = null; for (Map.Entry<String, Integer> entry : testMap.entrySet()) { assertNotNull(entry.getValue()); if (previous != null) { assertTrue(entry.getValue() >= previous); } previous = entry.getValue(); } } @Test public void testByKeyComparator() { Map<String, Object> original = new TreeMap<String, Object>(String.CASE_INSENSITIVE_ORDER) { // not serializing it private static final long serialVersionUID = 1L; { Class<?> anchor = getCurrentTestClass(); put("class", anchor); put("package", anchor.getPackage()); put("method", getCurrentTestName()); put("now", new Date()); put("nanos", Long.valueOf(System.nanoTime())); put("pi", Math.PI); } }; List<Map.Entry<String, Object>> expected = new ArrayList<>(original.entrySet()); Map<String, Object> hashed = new HashMap<>(original); List<Map.Entry<String, Object>> actual = new ArrayList<>(hashed.entrySet()); Comparator<Map.Entry<String, Object>> comp = MapUtils.byKeyComparator(String.CASE_INSENSITIVE_ORDER); Collections.sort(actual, comp); assertListEquals(getCurrentTestName(), expected, actual); } @Test public void testFlip() { Map<String, Long> src = new TreeMap<String, Long>() { private static final long serialVersionUID = -3686693573082540693L; { put("sysTime", Long.valueOf(7365L)); put("nanoTime", Long.valueOf(3777347L)); } }; Map<Number, CharSequence> dst = MapUtils.flip(false, src, new HashMap<Number, CharSequence>(src.size())); assertEquals("Mismatched size", src.size(), dst.size()); for (Map.Entry<String, Long> se : src.entrySet()) { String expected = se.getKey(); Long value = se.getValue(); CharSequence actual = dst.remove(value); assertSame("Mismatched key for value=" + value, expected, actual); } } @Test public void testFlipNullOrEmpty() { Map<Object, Object> dst = Collections.unmodifiableMap(new HashMap<>()); assertSame("Mismatached instance for null source", dst, MapUtils.flip(false, null, dst)); assertSame("Mismatached instance for empty source", dst, MapUtils.flip(false, Collections.emptyMap(), dst)); } @Test(expected = IllegalStateException.class) public void testFlipOnDuplicateKeys() { Map<String, String> map = new HashMap<>(); map.put("testName1", getCurrentTestName()); map.put("testName2", getCurrentTestName()); Map<String, String> flipped = MapUtils.flip(false, map, new TreeMap<String, String>()); fail("Unexpected success: " + flipped); } @Test public void testGetMandatoryValue() { Map<String, Object> map = new HashMap<>(); map.put("A", 1); map.put("B", 2); for (Map.Entry<String, ?> me : map.entrySet()) { String key = me.getKey(); Object expected = me.getValue(); Object actual = MapUtils.getMandatoryValue(map, key); assertSame("Mismatched mandatory value instance for key=" + key, expected, actual); } } @Test(expected = NullPointerException.class) public void testGetMandatoryValueWithoutValue() { Map<String, Object> map = new HashMap<>(); map.put("A", 1); map.put("B", 2); Object mandatoryValue = MapUtils.getMandatoryValue(map, getCurrentTestName()); fail("Unexpected success: " + mandatoryValue); } @Test(expected = NullPointerException.class) public void testGetMandatoryValueWithEmptyMap() { Map<String, Object> map = new HashMap<>(); Object mandatoryValue = MapUtils.getMandatoryValue(map, getCurrentTestName()); fail("Unexpected success: " + mandatoryValue); } @Test public void testGetMandatoryIntValue() { Map<String, Object> map = new HashMap<>(); map.put("A", 1); map.put("B", "2"); int mandatoryIntValueA = MapUtils.getMandatoryIntValue(map, "A"); assertEquals("Mismatched value for the 'A' key", 1, mandatoryIntValueA); int mandatoryIntValueB = MapUtils.getMandatoryIntValue(map, "B"); assertEquals("Mismatched value for the 'B' key", 2, mandatoryIntValueB); } @Test public void testGetMandatoryDoubleValue() { Map<String, Object> map = new HashMap<>(); map.put("A", 1.2); map.put("B", "2.2"); double mandatoryIntValueA = MapUtils.getMandatoryDoubleValue(map, "A"); assertEquals("Mismatched value for the 'A' key", 1.2, mandatoryIntValueA, 0); double mandatoryIntValueB = MapUtils.getMandatoryDoubleValue(map, "B"); assertEquals("Mismatched value for the 'B' key", 2.2, mandatoryIntValueB, 0); } @Test public void testNestedLen() { Map<String, Collection<Object>> mapOfColls = new HashMap<>(); Collection<Object> col1 = new ArrayList<>(); col1.add(1L); col1.add(2L); Collection<Object> col2 = new LinkedList<>(); col2.add(1L); col2.add(2L); col2.add(3L); mapOfColls.put("a", col1); mapOfColls.put("b", col2); assertEquals("Mismatched nested entries count", 5, MapUtils.nestedLen(mapOfColls)); } @Test public void testEmptyNestedLen() { assertEquals("Mismatched empty nested entries count", 0, MapUtils.nestedLen(new HashMap<String, Collection<Object>>())); } @Test public void testNullNestedLen() { assertEquals("Mismatched null 0 nested entries count", 0, MapUtils.nestedLen((Map<String, Collection<Object>>) null)); } @Test public void testClearNullOrEmptyMap() { assertNull("Unexpected null map clear result", MapUtils.clear(null)); @SuppressWarnings("unchecked") Map<String, String> expected = Mockito.mock(Map.class); Mockito.when(expected.size()).thenReturn(NumberUtils.INTEGER_ZERO); Mockito.when(expected.isEmpty()).thenReturn(Boolean.TRUE); Mockito.when(expected.toString()).thenReturn(getCurrentTestName()); Mockito.doAnswer(new Answer<Void>() { @Override public Void answer(InvocationOnMock invocation) throws Throwable { fail("Unexpected clear method invocation"); return null; } }).when(expected).clear(); Map<String, String> actual = MapUtils.clear(expected); assertSame("Mismatched cleared result reference", expected, actual); } @Test public void testClearNonEmptyMap() { Map<String, String> expected = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER) { // Not serializing it private static final long serialVersionUID = 1L; { put("testName", getCurrentTestName()); put("className", SafeUtils.safeShortName(getCurrentTestClass())); } }; Map<String, String> actual = MapUtils.clear(expected); assertSame("Mismatched cleared result reference", expected, actual); assertTrue("Map not cleared", actual.isEmpty()); assertEquals("Size not zeroed", 0, actual.size()); } @Test public void testClearAndReplace() { for (@SuppressWarnings("unchecked") Map<String, String> expected : new Map[] { null, Collections.emptyMap(), new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER) { // Not serializing it private static final long serialVersionUID = 1L; { put("testName", getCurrentTestName()); put("className", SafeUtils.safeShortName(getCurrentTestClass())); } } }) { Map<String, String> original = new HashMap<String, String>() { // Not serializing it private static final long serialVersionUID = 1L; { put("expected", Objects.toString(expected)); } }; Map<String, String> actual = MapUtils.clearAndReplace(original, expected); assertTrue("Original not cleared: " + original, original.isEmpty()); assertSame("Mismatched replacement", expected, actual); } } @Test public void testKeyExtractor() { Map<String, Object> map = new TreeMap<String, Object>() { // Not serializing it private static final long serialVersionUID = 1L; { put("testName", getCurrentTestName()); put("className", getCurrentTestClass()); } }; Transformer<Map.Entry<String, Object>, String> keyExtractor = MapUtils.keyExtractor(); for (Map.Entry<String, Object> entry : map.entrySet()) { String expected = entry.getKey(); String actual = keyExtractor.transform(entry); assertSame(expected, actual); } } @Test public void testValueExtractor() { Map<String, Object> map = new TreeMap<String, Object>() { // Not serializing it private static final long serialVersionUID = 1L; { put("testName", getCurrentTestName()); put("className", getCurrentTestClass()); } }; Transformer<Map.Entry<String, Object>, Object> valueExtractor = MapUtils.valueExtractor(); for (Map.Entry<String, Object> entry : map.entrySet()) { String key = entry.getKey(); Object expected = entry.getValue(); Object actual = valueExtractor.transform(entry); assertSame(key, expected, actual); } } @Test public void testFilterByKey() { String expectedKey = "testName"; Map<String, Object> map = new HashMap<String, Object>() { // Not serializing it private static final long serialVersionUID = 1L; { put(expectedKey, getCurrentTestName()); put("className", getCurrentTestClass()); } }; Map.Entry<String, Object> expEntry = Pair.of(expectedKey, map.get(expectedKey)); NavigableMap<String, Object> actual = MapUtils.filterByKey(map, k -> expectedKey.equals(k), TreeMap::new); assertMapEquals(getCurrentTestName(), Collections.singletonMap(expEntry.getKey(), expEntry.getValue()), actual); Map.Entry<String, Object> actEntry = SafeUtils.head(actual.entrySet()); assertSame("Mismatched key instance", expEntry.getKey(), actEntry.getKey()); assertSame("Mismatched value instance", expEntry.getValue(), actEntry.getValue()); } @Test public void testFilterByEntry() { Map<Integer, Integer> map = new HashMap<>(); for (int index = 1; index <= Byte.SIZE; index++) { map.put(index, index & 0x01); } Map<Integer, Integer> expected = new HashMap<>(); Predicate<Map.Entry<Integer, Integer>> selector = e -> (e.getKey() > 3) && (e.getKey() <= 7) && ((e.getValue() & 0x01) == 0); map.forEach((key, value) -> { if (selector.test(Pair.of(key, value))) { expected.put(key, value); } }); Map<Integer, Integer> actual = MapUtils.filterByEntry(map, selector, TreeMap::new); assertMapEquals(getCurrentTestName(), expected, actual); } @Test public void testEqualPropertiesCaseSensitiveName() { Properties p1 = new Properties() { // Not serializing it private static final long serialVersionUID = 1L; { setProperty(getCurrentTestName(), getCurrentTestName()); Class<?> c = getCurrentTestClass(); setProperty(c.getSimpleName(), c.getSimpleName()); Package pkg = c.getPackage(); setProperty(pkg.getName(), pkg.getName()); } }; Properties p2 = new Properties(); for (String name : p1.stringPropertyNames()) { String key = shuffleCase(name); String value = p1.getProperty(name); p2.setProperty(key, value); } assertFalse("Unexpected case sensitive equality", MapUtils.equalProperties(p1, p2)); assertTrue("Non-equal case insensitive result", MapUtils.equalProperties(p1, p2, String.CASE_INSENSITIVE_ORDER, Comparator.naturalOrder())); } @Test public void testEqualPropertiesCaseSensitiveValue() { Properties p1 = new Properties() { // Not serializing it private static final long serialVersionUID = 1L; { setProperty(getCurrentTestName(), getCurrentTestName()); Class<?> c = getCurrentTestClass(); setProperty(c.getSimpleName(), c.getSimpleName()); Package pkg = c.getPackage(); setProperty(pkg.getName(), pkg.getName()); } }; Properties p2 = new Properties(); for (String key : p1.stringPropertyNames()) { String value = p1.getProperty(key); p2.setProperty(key, shuffleCase(value)); } assertFalse("Unexpected case sensitive equality", MapUtils.equalProperties(p1, p2)); assertTrue("Non-equal case insensitive result", MapUtils.equalProperties(p1, p2, Comparator.naturalOrder(), String.CASE_INSENSITIVE_ORDER)); } @Test public void testSubMapWithEmptyMaps() { Map<String, Integer> m1 = new HashMap<>(); m1.put(getCurrentTestName(), 1); Collection<Map<String, Integer>> empties = Arrays.asList(null, Collections.emptyMap()); for (Map<String, Integer> empty : empties) { assertTrue("empty is submap of any map", MapUtils.isSubMap(m1, empty)); assertFalse("nothing is a submap of empty", MapUtils.isSubMap(empty, m1)); assertTrue("empty is submap of empty", MapUtils.isSubMap(empty, empty)); } } @Test public void testSubMapWithSubs() { Map<String, Integer> m1 = new HashMap<>(); m1.put(getCurrentTestName(), 1); Map<String, Integer> m2 = new HashMap<>(); m2.put(getCurrentTestName(), 1); assertTrue("equal maps are sub maps", MapUtils.isSubMap(m1, m2)); assertTrue("equal maps are sub maps", MapUtils.isSubMap(m2, m1)); m1.put(JAVA_SUFFIX, 2); assertTrue("strictly sub", MapUtils.isSubMap(m1, m2)); assertFalse("non sub", MapUtils.isSubMap(m2, m1)); int differentValueForKey = m1.get(JAVA_SUFFIX) + 1; m2.put(JAVA_SUFFIX, differentValueForKey); assertFalse("non sub", MapUtils.isSubMap(m1, m2)); assertFalse("non sub", MapUtils.isSubMap(m2, m1)); } @Test public void testGetSubMap() { Map<String, Integer> hashMap = new HashMap<>(); hashMap.put(getCurrentTestName(), 1); hashMap.put(JAVA_SUFFIX, 2); hashMap.put(JAVA_TYPE, 3); NavigableMap<String, Integer> expectedSingletonMap = MapUtils.getSubMap(hashMap, e -> e.getValue() > 2, TreeMap::new); assertEquals(Collections.singletonMap(JAVA_TYPE, 3), expectedSingletonMap); Map<String, Integer> treeMap = new TreeMap<>(hashMap); Map<String, Integer> expectedEmpty = MapUtils.getSubMap(treeMap, e -> e.getValue() > 3, HashMap::new); assertEquals(Collections.emptyMap(), expectedEmpty); Map<String, Integer> expectedAllEntries = MapUtils.getSubMap(treeMap, e -> e.getValue() < 10, HashMap::new); assertEquals(treeMap, expectedAllEntries); } @Test public void testGetSubMapEmpty() { assertEquals(Collections.emptyMap(), MapUtils.getSubMap(Collections.emptyMap(), e -> true, TreeMap::new)); assertEquals(Collections.emptyMap(), MapUtils.getSubMap(null, e -> true, HashMap::new)); } }
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4