Hello,
I'm using Eclipse along with plugin m2eclipse to build and manage my project. In POM, I have included entry for servlet-api:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
Scope is provided, not to include the .jar file to .war package, (it is already provided by the tomcat servlet container). Compilation by mvn install is correct, file is not included into WEB-INF\lib, deployment to tomcat is working, program is working, it's ok.
But, the case starts inside Eclipse. After starting my web application from eclipse, i'm getting error:
\WEB-INF\lib\servlet-api-2.5.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
I don't know why, because, Maven Dependencies(including javac-servlet-2.5.jar) are included as Java EE Module Dependencies, and should be putted inside WEB-INF\lib folder, while starting from eclipse. On the other hand, in eclipse I've provided path to my apache tomcat directory, and inside project, there are automatic references to libraries from Apache Tomcat v6.0 including servlet-api.jar.
So basically, after removeing reference from the POM to servlet-api-2.5.jar, that library dissapears from Maven Dependencies, and I get no exception while starting my web app from eclipse. Everything is fine... in eclipse.
Of course without entry inside POM, this time mvn install failes with the same exception, I have provided earlier.
Is there any way to make it working without removing and than inserting reference, depending of what I want to do: compile with maven or run with Eclipse ?
Regards