Running tomcat jasper task (jspc) with gradle build

后端 未结 1 1467
你的背包
你的背包 2021-01-03 14:52

I\'m trying to compile our jsp files using jspc within gradle but am getting an exception.

Here is the pertinent gradle section

//tomcatHome is defin         


        
1条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-03 15:47

    Instead of using catalina-tasks.xml from Tomcat's bin directory you can use the Tomcat JAR file that includes the class org.apache.jasper.JspC instead. If there are any libraries missing for your JSP compilation you can easily add them to the configuration jasper.

    configurations {
        jasper
    }
    
    repositories {
        mavenCentral()
    }
    
    dependencies {
        jasper 'org.apache.tomcat:jasper:6.0.33',
               'javax.servlet:jstl:1.1.2',
               'taglibs:standard:1.1.2'
    }
    
    test.doLast {
        ant.taskdef(classname: 'org.apache.jasper.JspC', name: 'jasper', classpath: configurations.jasper.asPath)
        ant.jasper(validateXml: false, uriRoot: webAppDir, outputDir: "$buildDir/jspc")
    }
    

    0 讨论(0)
提交回复
热议问题