I am trying to use the tomcat plugin with gradle. we have customized our
tomcat libraries to include versions of jasper-el / el-api that support
parameters, so the default 6.0.29 versions have been removed and
tomcat-jasper-el and tomcat-el-api 7.0.4 have been added to allow EL
statements like "#{myBean.test('param')}".

In order to bootstrap the libraries for the tomcat plugin startup, I use the
following configuration, based on the README. The problem is that the
buildscript resolves dependencies (specifically of jasper-6.0.29) and ends
up with el-api and jasper-el 6.0.29 on the classpath, and so I get an error
of:

com.sun.el.parser.ParseException: Encountered "(" at line 1, column 14

Here is a part of the gradle script:

buildscript {
    repositories {
        mavenRepo name: 'repo_bootstrap', urls: "
http://artifactory.local/repo";
    }

    configurations {
        classpath.exclude module: 'el-api'
        classpath.exclude module: 'jasper-el'
    }

    dependencies {
        def tomcatVersion = '6.0.29'
        def tomcatElVersion = '7.0.4'
        def mysqlVersion = '5.1.13'

        classpath "org.apache.tomcat:catalina:${tomcatVersion}",
                "org.apache.tomcat:coyote:${tomcatVersion}",
                "org.apache.tomcat:jasper:${tomcatVersion}",
                "org.apache.tomcat:tomcat-el-api:${tomcatElVersion}",
                "org.apache.tomcat:tomcat-jasper-el:${tomcatElVersion}",
                "mysql:mysql-connector-java:${mysqlVersion}",
                "gradle-tomcat-plugin:gradle-tomcat-plugin:0.3"
    }
}


If I run in debug mode, I see that jasper is pulling in el-api and jasper-el
version 6.0.29, how would I go about configuring the classpath correctly? I
have tried adding the following to the build script, in order to pull
jasper-6.0.29 later (and remove it from the buildscript section above):

configuration {
   warPath { extendsFrom runtime }
   warPath.exclude module: 'el-api'
   warPath.exclude module: 'jasper-el'
}

dependencies {
   warPath "org.apache.tomcat:jasper:6.0.29"
}

tomcatRun {
    classpath = classpath + configurations.warPath
}

When I try run tomcatRun from that, I get a parse error in application
web.xml, and application is not deployed to the container.

I know i'm probably overlooking some basic principle in setting up the
classpath for tomcat in gradle, but can't figure out where i'm going wrong
and how to do it correctly.

Reply via email to