how to add the servlet api to my pom.xml

后端 未结 6 856
天涯浪人
天涯浪人 2020-12-17 08:00

How do I add the servlets API to my project\'s pom.xml

mvnrepository.com has lots of servlet api and similarly named projects, that I don\'t know which is the right

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-17 08:21

    I believe most web/app servers come bundled with a version of the servlet api, so you won't want to bundle the api in your .war file. You will need to find out which version is included with your server, then you can use

    
        javax.servlet
        servlet-api
        ${servlet-api-version}
        provided
    
    

    replacing servlet-api-version with your version. You will want to specify the "provided" scope so the api.jar isn't included in your war file.

提交回复
热议问题