I am pretty new to gradle and build systems, I am trying to build project with gradle, but it cannot find packages of Tomcat server that I use in several classes of my project.
My build config:
apply plugin: 'java'
apply plugin: 'war'
repositories {
flatDir { dirs "WebContent/WEB-INF/lib" }
mavenCentral()
}
dependencies {
compile group: 'com.orientechnologies', name: 'orient-commons', version: '1.3.0'
compile group: 'com.orientechnologies', name: 'orientdb-client', version: '1.3.0'
compile group: 'com.orientechnologies', name: 'orientdb-core', version: '1.3.0'
compile group: 'com.orientechnologies', name: 'orientdb-graphdb', version: '1.3.0'
compile group: 'com.orientechnologies', name: 'orientdb-enterprise', version: '1.3.0'
compile group: 'com.tinkerpop.blueprints', name: 'blueprints-core', version: '2.3.0'
compile group: 'com.tinkerpop.blueprints', name: 'blueprints-orient-graph', version: '2.3.0'
compile group: 'com.tinkerpop', name: 'pipes', version: '2.3.0'
compile group: 'com.tinkerpop.gremlin', name: 'gremlin-java', version: '2.3.0'
compile group: 'com.tinkerpop.gremlin', name: 'gremlin-groovy', version: '2.3.0'
testCompile group: 'junit', name: 'junit', version: '4.+'
testCompile group: 'org.mockito', name: 'mockito-all', version: '1.9.5'
}
sourceSets {
main {
java {
srcDir 'src'
}
}
test {
java {
srcDir 'test'
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '1.3'
}
war {
from 'WebContent'
}
Errors occur, when I launch Gradle Task - Build:
OrientDBFilter.java:6: error: package javax.servlet does not exist
import javax.servlet.FilterChain;
OrientDBFilter.java:5: error: package javax.servlet does not exist
import javax.servlet.Filter;
....
An abstract class that simplifies writing HTTP servlets. It extends the GenericServlet base class and provides an framework for handling the HTTP protocol. Because it is an abstract class, servlet writers must subclass it and override at least one method.
The javax. servlet package contains a number of classes and interfaces that describe and define the contracts between a servlet class and the runtime environment provided for an instance of such a class by a conforming servlet container. The javax.
Usually you would use providedCompile
. Something like:
providedCompile group: 'javax.servlet', name: 'javax.servlet-api', version: '3.0.1'
Then your app will compile, but gradle won't include the servlet api in the final war file.
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