Maven ERROR: package javax.servlet does not exist -


this question has answer here:

i starting on legacy project , trying build using maven. i'm using eclipse ee , tomcat v7.0. error in title line above arises when run "mvn package" in terminal. error stumping me because in pom.xml file have following dependency

<dependency> <groupid>javax.servlet</groupid> <artifactid>jstl</artifactid> <version>1.2</version> </dependency> 

i've checked in properties>targeted runtimes , made sure tomcat v7.0 selected runtime. i'm it's problem eclipse environment, , suggestions on how fix it.

edit: here's additional information. first output after run "mvn package" is

failed execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project myproject: compilation failure: compilation failure: 

this followed strange error forgot include in original posting. it's weird because, package javax.servlet, org.apache.catalina should included in tomcat

[error] /path/to/main.java:[7,26] error: package org.apache.catalina not exist 

also, think mixed meaning of legacy project, because isn't old project. it's project had lot of work done on i'm helping original creator with.

the dependency you're missing servlet api.

<dependency>     <groupid>javax.servlet</groupid>     <artifactid>servlet-api</artifactid>     <version>2.5</version>     <scope>provided</scope> </dependency> 

be sure import correct version of api. legacy project, older version 2.5.

as mentionned grzegorz, should use scope provided since servlet api should provided application server (e.g. tomcat).


Comments