On 30/07/10 6:01 PM, Magnus Rundberget wrote:
Hi,

I have a requirement to compile jsp files for war files.
The compilation of jsp's is rather time consuming so I wish for it only to execute when the war file it uses as input (or any of the tasks custom dependencies) has actually changed.

Any tips on what I need to add to input.files (or alternative solutions) to the below to make this work ?

// ------ setup compile jsp task for wars -----
    task compileJsp(dependsOn: 'assemble') {
        onlyIf {
            project.hasProperty('compile_jsp')
            //dependsOnTaskDidWork()
        }

        inputs.files  configurations.jspCompileLibs
        doLast {
appcClassPath = "c:/bea_103/wlserver_10.3/server/lib/weblogic.jar"
            if (configurations.jspCompileLibs.asPath) {
appcClassPath = appcClassPath + ";" + configurations.jspCompileLibs.asPath
            }
ant.java(classname: 'weblogic.appc', fork: true, classpath:appcClassPath, failOnError: true) {
                arg(line: war.archivePath)
                arg(line: "-compiler jdt")
            }
        }

    }
    build.dependsOn compileJsp
    // ------ end setup compile jsp ---------

PS the jsp compiler takes a war as input, compiles the jsps and packages a new war file with the same name as the input war

The incremental build support currently does not handle tasks which overwrite their input files, as you're trying to do. Of course, it should, but doesn't yet. What will happen with the above is that the war and compileJsp tasks will always be out-of-date.

Is there some way to have the jsp compiler generate the output file to a different path? Then, the compileJsp would declare the following:

inputs.files war.outputFiles
inputs.files configurations.jspCompileLibs
outputs.files 'build/distributions/warWithPrecompiledJsps.war'

It wouldn't need the dependency on 'assemble' then, either.


--
Adam Murdoch
Gradle Developer
http://www.gradle.org
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz

Reply via email to