I am getting ‘NoClassDefFoundError’ while running PMD task via Gradle 2.0 .
I am having ‘pmd-5.1.1.jar’, ‘commons-io-1.4.jar’ as well as all the other ‘jars’ in ‘WebContent/WEB-INF/lib’ directory. My java files are in the directory ‘src\com\company\project’
Gradle Build file
apply plugin: ‘java’
apply plugin: ‘war’
apply plugin: ‘pmd’
sourceSets.main.java.srcDirs = [‘src’]
webAppDirName = ‘WebContent’
repositories {
flatDir { dirs “WebContent/WEB-INF/lib” }
}
dependencies {
providedCompile fileTree(dir: “WebContent/WEB-INF/lib”, include: ‘*.jar’)
}
war {
archiveName “ROOT.war”
}
Error Log
C:\MyWorkspace\MyProject>gradle build
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:war UP-TO-DATE
:assemble UP-TO-DATE
:pmdMain FAILED
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ‘:pmdMain’.
java.lang.NoClassDefFoundError: org/apache/commons/io/IOUtils
- Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
BUILD FAILED
Total time: 5.275 secs
This is the first time I am trying Gradle. I am able to build as well as generate WAR but PMD is failing me. Can someone please tell me what am I doing wrong? Thanks in advance