I have the following dependency in my pom.xml so that my IDE (IntelliJ) has the servlet-api classes available during compilation, but not provided in the build.
For Gradle users, a setup with Jetty running an embedded webapp based on Spring WebMVC works with the following dependencies:
apply plugin: 'war'
apply plugin: 'jetty'
apply plugin: 'eclipse-wtp'
dependencies {
// Logging support
compile 'org.slf4j:slf4j-api:1.7.7'
runtime 'org.slf4j:slf4j-simple:1.7.7'
// Spring WebMVC part
compile 'org.springframework:spring-web:4.0.6.RELEASE'
compile 'org.springframework:spring-webmvc:4.0.6.RELEASE'
compile 'org.springframework:spring-context:4.0.6.RELEASE'
compile 'org.springframework:spring-core:4.0.6.RELEASE'
compile 'org.springframework:spring-beans:4.0.6.RELEASE'
compile 'org.springframework:spring-expression:4.0.6.RELEASE'
// Jetty support
compile 'org.eclipse.jetty:jetty-server:8.1.4.v20120524'
compile 'org.eclipse.jetty:jetty-servlet:8.1.4.v20120524'
compile 'org.eclipse.jetty:jetty-webapp:8.1.4.v20120524'
compile 'org.eclipse.jetty:jetty-jsp:8.1.4.v20120524'
// Web Container interaction
//providedCompile 'javax.servlet:servlet-api:2.5'
runtime 'jstl:jstl:1.2'
// Unit Testing
testCompile 'junit:junit:4.11'
testCompile 'org.mockito:mockito-all:1.9.5'
testCompile 'org.springframework:spring-test:3.2.0.RELEASE'
}