How to compile jsp files using wsjspc(websphere compiler) in gradle?

I am migrating one project from ant to gradle.Now I am stuck in compiling jsp files as this project is using wsjspc(websphere compiler). So default attributes are not supported. Kindly suggest me something so that I could proceed further and build successfully.

Below are my code what I have written to compile jsp:

task compileJsp{
def jspcDir = new File("buildDir/bin/classes/jsp/**") jspcDir.mkdirs(); ant.taskdef(classname: 'com.ibm.websphere.ant.tasks.JspC', name: 'wsjspc', classpath: configurations.wsjspc.asPath) ant.wsjspc(uriRoot: "{buildDir}/bin/classes/jsp/**", outputDir: “$buildDir/jspc”){

	fileset(dir: '../bin/classes/jsp/**', includes: '**/*.jsp', excludes: "WEB-INF")
}

}

Kindly Suggest. Thanks in advance.

Hello, I am facing similar problem. Were you able to solve yours?

There is the plugin Gradle - Plugin: com.liferay.jasper.jspc which might help to compile JSP files.
If it must be the specific WebSphere JSPC tool, you could either run it through some Exec task, or you can also use the actual Ant task.
Ant is first-class citizen in Gradle, so you can basically use all Ant tasks out there, it is just not as nice and convenient as it is when a dedicated Gradle task implementation exists.
The documentation shows how to run Ant tasks at Using Ant from Gradle

1 Like