I have your basic run of the mill Gradle web application project and it works ok but I noticed that Gradle's runtime classpath is being included in the jetty one which has the potential to conflict with the web applications.
Notice below that gradle is using a slightly older version of logback and that SL4J is warning that it found multiple bindings in the classpath.
:jettyRun
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/dev/java/tools/gradle-1.0-milestone-5/lib/logback-classic-0.9.29.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/kirk.rasmussen/.gradle/caches/artifacts-3/ch.qos.logback/logback-classic/fd9fe39e28f1bd54eee47f04ca040f2b/jars/logback-classic-0.9.30.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
Is there a way to exclude the gradle runtime classpath from being included when running jettyRun task? I'm using the latest 1.0 milestone 5 version of Gradle.
I'm looking for something along the lines of 'includeAntRuntime' in the javac task in Ant.
http://ant.apache.org/manual/Tasks/javac.html
includeAntRuntime Whether to include the Ant run-time libraries in the classpath; defaults to yes, unless build.sysclasspath is set. It is usually best to set this to false so the script's behavior is not sensitive to the environment in which it is run.
Stripped down build.gradle:
apply plugin: 'groovy'
apply plugin: 'war'
apply plugin: 'jetty'
jettyRun {
contextPath = ''
}
As described in the manual for jettyRun task, it has a classpath
property which is by default set to project.sourceSets.main.runtimeClasspath
. You can just set this property to the classpath of your choice:
configurations{
myJettyRuntime
}
dependencies{
myJettyRuntime "group:name:version"
...
}
jettyRun{
classpath = configurations.myJettyRuntime
}
alternatively you can add or subtract unneeded or conflicting dependencies from this classpath, using -=
and +=
operators respectively.
jettyRun{
classpath -= configurations.myExcludedConf
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With