I am new to Gradle. I've setup my project as a Gradle Project
with the Gradle plugin, so that the project configuration is rebuilt based on the gradle build script. I'm trying to setup my app as a dynamic web project (using the eclipse-wtp
Gradle plugin), and do so that, I need my project to have access to the Tomcat Server Runtime
library.
Apparently the way to do that in Gradle is to set it up as a "provided dependency," which should only be used for compile but not deployed. However, that's not working for me for my IDE Tomcat deploys. It appears Gradle is configuring two sets of dependencies: Web App Libraries
, which respects the provided dependency setting, and Grade Dependencies
, which does not. Both are getting included in the web app deployment assembly, which means the "provided" Tomcat jars are getting deployed and preventing Tomcat from starting.
How can I configure Gradle to prevent the Gradle Dependencies
from being automatically being included in the Eclipse deployment assembly screen? I cannot manually remove it, since it will just get refreshed the next time Gradle runs.
I've already tried Remove Gradle Dependency Management
(Right click project -> Gradle -> Remove Gradle Dependency Management), but that doesn't work. It solve the Tomcat problem, but then my testing dependencies are no longer on the build path, which causes my unit tests to have errors.
The above actually works if you then also manually Gradle -> Refresh All
. That will cause the Gradle Eclipse plugin to regenerate a the configuration files, and the dependencies that are not part of Web App Libraries
will be included in Referenced Libraries
.
Gradle -> Remove Dependency Management
will just remove the Grade Dependencies
library, and is not sufficient in and of itself.
I am using:
- Eclipse Luna SR1a (4.4.1)
- Gradle IDE Plugin 3.7.0 (https://marketplace.eclipse.org/content/gradle-integration-eclipse-0)
This is the library which is causing problems, it includes the "provided" Tomcat jars:
This is my build.gradle file:
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'war'
apply plugin: 'eclipse-wtp'
webAppDirName = 'WebContent'
// <snip>
dependencies {
providedCompile('org.apache.tomcat:tomcat-catalina:7.0.34')
// <snip>
}
// snip