Search code examples
maveneclipse-kepler

After Cleaning a Maven Project from command prompt the server runtime library gets deleted


I am new to maven.

  1. I created a dynamic web project and converted to maven project.
  2. Then from command prompt i cleaned the project using mvn eclipse:clean
  3. I refreshed the project in eclipse
  4. It comes up with an error like JSP Problem : (the server runtime library deleted)

The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path home.jsp

After adding the server runtime library manually the problem solved. Is there any other way to solve the problem or the problem will not occur at all.


Solution

  • Add below dependency in your pom.xml to avoid the exception:

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.1.0</version>
        <scope>provided</scope>
    </dependency>