Hi

I am trying to compile jasperreport's templates (.jrxml) but has not been 
successful with gradle v0.9-rc-3

Heres my script
____________________________________________________
apply plugin: 'java'

repositories {
    mavenCentral()
}

configuration {
    jasperreports {
        transitive = true
    }
}

dependencies {
    jasperreports 'net.sf.jasperreports:jasperreports:3.7.0',
                  'org.codehaus.groovy:groovy-all:1.7.4'
}

sourceSets {
    jasper {
        srcDir = file(relativePath('src/main/templates'))
    }
}

task compileJasperJava(overwrite: true) << {
    ant {
        taskdef(name: 'jrc', classname: 
'net.sf.jasperreports.ant.JRAntCompileTask', classpath: 
configurations.jasperreports.asPath)
        sourceSets.jasper.classesDir.mkdirs()
        jrc(srcdir: sourceSets.jasper.srcDir, destdir: 
sourceSets.jasper.classesDir) {
            include(name:'**/*.jrxml')
        }
    }
}

classes.dependsOn compileJasperJava
____________________________________________________


Exceptions will be thrown that complains its unable to resolve class from 
jasperreports.jar. e.g. JRFillParameter, JREvaluator and etc. Having a 
println of 'configurations.jasperreports.asPath' show that jasperreports 
and dependencies jar are correctly resolved.

This solution used to work in 0.8 with some manual tweak:- by copying 
jasperreport and its dependencies jars into {user.home}/.ant/lib folder

Please help. Thanks

Soon Dee

Reply via email to