using windows 7 (64 bit version) with gradle 1.6
java -version info
Java version "1.7.0"
Java Runtime Encironment (build
1.7.0-b147)
Java Hotspot 64Bit Server VM - (build 21.0-b17, mixed mode)
gradle Info…
------------------------------------------------------------
Gradle 1.6
------------------------------------------------------------
Gradle build time: Tuesday, May 7, 2013 9:12:14 AM UTC
Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.8.4 compiled on May 22 2012
Ivy: 2.2.0
JVM: 1.7.0 (Oracle Corporation 21.0-b17)
OS: Windows 7 6.1 amd64
Here is the gradle file I have been playing around with…
apply plugin: "java"
apply plugin: "pmd"
sourceSets {
main {
java {
srcDir 'src'
}
resources {
srcDir 'resources/src'
}
}
test {
java {
srcDir 'test'
}
resources {
srcDir 'resources/test'
}
}
}
pmd {
toolVersion = "5.0.4"
println "${toolVersion}"
ignoreFailures = true
ruleSets = ['basic', 'design', 'braces', 'unusedcode', 'codesize', 'controversial', 'coupling', 'naming', 'javabeans' , 'typeresolution']
}
test {
forkEvery = 10
maxParallelForks = 4
}
configurations {
runtime {
transitive = false
}
}
repositories{
mavenCentral()
}
dependencies {
//pmd 'pmd:pmd:5.0.3'
//pmd 'net.sourceforge.pmd:pmd:5.0.4'
compile fileTree(dir:'lib', include: '*.jar')
testCompile 'org.testng:testng:6.8.+'
}
archivesBaseName = 'testing-sample'
version = '0.0.1'
sourceCompatibility = JavaVersion.VERSION_1_7
def dateTime = new Date()
manifest = manifest {
attributes(
'Package-Name' : 'Testing Sample',
'Version' : version + ' - ' + dateTime.format('MMM dd yyyy'),
'Compiled-With-Jvm-Version' : JavaVersion.current()
)
}
//Need to explicity set manifest on jar task
jar.manifest.from manifest
project.description = 'Simple project'
def something = "Custom Property"
task simple(description: "Simple Task") << {
println "Running simple task for project " + project.description
}
task first(description: "First Task") << {
println "Running first task!"
}
task showProperties << {
println "Version: $version"
println "Custom property: $something"
println "Java Version: ${JavaVersion.current()}"
}
task sourceSetJavaProperties << {
sourceSets {
main {
println "java.srcDirs = ${java.srcDirs}"
println "resources.srcDirs = ${resources.srcDirs}"
println "java.files = ${java.files.name}"
println "allJava.files = ${allJava.files.name}"
println "resources.files = ${resources.files.name}"
println "allSource.files = ${allSource.files.name}"
println "output.classesDir = ${output.classesDir}"
println "output.resourcesDir = ${output.resourcesDir}"
println "output.files = ${output.files}"
}
}
}
tasks.addRule("Pattern: desc<TaskName>: show description of a task."){
taskName ->
if (taskName.startsWith("desc")) {
def targetTaskName = taskName - 'desc'
def targetTaskNameUncapitalize = targetTaskName[0].toLowerCase() + targetTaskName[1..-1]
def targetTask = project.tasks.findByName(targetTaskNameUncapitalize)
if(targetTask) {
task(taskName) << {
println "Description of task ${targetTask.name} -> ${targetTask.description}"
}
}
}
}
test.useTestNG()
I have tried doing
dependencies {
pmd 'pmd:pmd:5.0.3'
}
and
pmd { toolVersion = '5.0.4' }
Still no luck. Maybe there is something wrong in my build.gradle file?
I am just typing “gradle -s check” on the command line…
Also from what I can tell the groupId changed to “net.sourceforge.pmd” when version 5 was released? Link where I got the maven info from
Just have been following along with the “Gradle Effective Implementation Guide” Book and I know it’s based off of gradle version 1.0.0 rc2, so I might be doing something that has been changed. But it’s weird that this works fine when I use pmd version 4.2.6 or 4.3…
Thanks.