开发者

how to avoid servlet-api.jar and jsp-api.jar copying into tomcat deployment

I'm using myeclipse and to compile successfully I have servlet-api.jar and jsp-api.jar in the java build path library. The problem occurs when the myeclipse d开发者_如何学编程eploy the web application to tomcat and these two jars interfering with tomcat version of these two jars. I want to avoid these two jars including in webapp WEB-INF/lib directory. I'm not using ant, just using myelcipse sandbox tomcat server to deploy. Thanks.


Firstly, you're better off using the Server Runtime library that provides the necessary classes and interfaces for compiling servlets and JSPs, instead of relying on manually added JARs like servlet-api.jar and jsp-api.jar.

Secondly, if these are not manually added JARs, but rather embedded due to another dependency, you might want to check whether it is possible to restrict MyEclipse from embedding these JARs when building the WAR/EAR file. Usually this is achieved by opening the Properties dialog of the dynamic web project, and then unchecking these JARs in the Java EE Module dependencies property page (the individual JARs should appear listed in the Web Libraries tab).


1.Project tab 2.Properties 3.Select 'Java Build Path' 4.Click 'Libraries tab' 5.Click 'Add External JARs' 6.Browse to the location where the JAR files are located 7.Add them. 8.Click 'OK'.


Thanks Vineet, but I did resolve it by the following procedure.

Go to project properties by right clicking the project in myeclipse, then :

Java Build Path --> Libraries tab --> Add Library on right pane --> MyEclipse Libraries --> Java EE 5 Libraries

Check this Java EE 5 check box which resolves the jsp/servlet compile time issues.

So whatever now in the WEB-INF/lib is perfect (do not add servlet-api.jar or jsp-api.jar).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜