开发者

How do I make Eclipse automatically include jars I place in my WEB-INF/lib folder into my project?

开发者 https://www.devze.com 2022-12-20 05:06 出处:网络
When I was doing JSP/Servlet programming, whenever I dropped 3rd party libraries into the WEB-INF/lib folder, they were automatically included in the project classpath. In GWT, this is not the cas开发

When I was doing JSP/Servlet programming, whenever I dropped 3rd party libraries into the WEB-INF/lib folder, they were automatically included in the project classpath. In GWT, this is not the cas开发者_如何学运维e. Anyone know why? I loved how easy this was in JSP and I'd like these jars to be included automatically the same way.


If you are using the Google Plugin for Eclipse then my understanding is that a Google Web Application Project is just not the same animal than a Dynamic Web Project and thus behave differently. So if your project depends on libraries not provided by the GWT and App Engine SDKs, you'll need to put them in war/WEB-INF/lib and to add them explicitly to your Java build path.


In Eclipse Galileo, right click the web project and select build path then select the Java EE Module Dependencies and add the jars.


There is a plug-in technique that may help you if you want a directory where new jars are automatically updated in your build path, see this other post:

Eclipse buildpath automatically taking all JARs of a internal directory

The reason it works like this for your JSP's is because that is how the Dynamic Web Project was made to behave.

"If you remove a library path entry but not the JAR file, the library entry will be re-added to the path automatically." from http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.wst.webtools.doc.user/topics/ccwebprj.html


You could adopt Maven and use the Maven Eclipse Plugin; this plugin would update your classpath whenever you add a dependency. There may be a similar plugin for Ivy.

0

精彩评论

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

关注公众号