Khoulaiz / gradle-jetty-eclipse-plugin

Gradle Jetty Plugin for Eclipse Jetty
Apache License 2.0
38 stars 10 forks source link

additionalRuntimeJars fails to add jars to classPath #15

Open byronpdx opened 9 years ago

byronpdx commented 9 years ago

Here is my build file with relevant sections:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath(group: 'com.sahlbach.gradle', name: 'gradle-jetty-eclipse-plugin', version: '1.9.+')
    }
}

plugins {
    id 'java'
    id 'war'
}

apply plugin: 'jettyEclipse'

sourceCompatibility = 1.8
targetCompatibility = 1.8

// jettyEclipse
jettyEclipse {
    httpPort = 8081
    contextPath = "/iobss"
    jettyConfig = file("$rootDir/iobss.xml")
    additionalRuntimeJars = [file("${buildDir}/tmp/jettyEclipseRun/webapp/WEB-INF/lib/commons-dbcp2-2.1.jar")]
}

The iobss.xml file contains the jndi

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
    <New id="cf" class="org.eclipse.jetty.plus.jndi.Resource">
        <Arg></Arg>
        <Arg>java:comp/env/jdbc/OBSS</Arg>
        <Arg>
            <New class="org.apache.commons.dbcp2.BasicDataSource">
                <Set name="driverClassName">com.mysql.jdbc.Driver</Set>
                <Set name="url">jdbc:mysql://localhost/obss</Set>
                <Set name="username">.....</Set>
                <Set name="password">.....</Set>
                <Set name="validationQuery">select 1</Set>
                <Set name="testOnBorrow">true</Set>
                <Set name="softMinEvictableIdleTimeMillis">90000</Set>
            </New>
        </Arg>
    </New>

</Configure>

The error I get is java.lang.ClassNotFoundException: org.apache.commons.dbcp2.BasicDataSource which seems to indicate to me that the library is not getting added to the classpath prior to the start of the configuration of Jetty. I can't seem to figure out any way around this problem and I need to be able to set the context above.

Again not sure if this is a bug or something I don't understand! Any help would be appreciated.