简体   繁体   English

如何让Eclipse自动将我放在WEB-INF / lib文件夹中的jar包含到我的项目中?

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

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. 当我进行JSP / Servlet编程时,每当我将第三方库放入WEB-INF / lib文件夹时,它们都会自动包含在项目类路径中。 In GWT, this is not the case. 在GWT中,情况并非如此。 Anyone know why? 谁知道为什么? I loved how easy this was in JSP and I'd like these jars to be included automatically the same way. 我喜欢这在JSP中的容易程度,我希望这些罐子能够以相同的方式自动包含在内。

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. 如果您使用的是Google Plugin for Eclipse,那么我的理解是Google Web应用程序项目动态Web项目不同,因此表现不同。 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. 因此,如果您的项目依赖于GWT和App Engine SDK未提供的库,则需要将它们放在war/WEB-INF/lib ,并将它们显式添加到Java构建路径中。

在Eclipse Galileo中,右键单击Web项目并选择构建路径,然后选择Java EE Module Dependencies并添加jar。

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: 如果你想要一个在你的构建路径中自动更新新jar的目录,有一种插件技术可以帮助你,请参阅另一篇文章:

Eclipse buildpath automatically taking all JARs of a internal directory Eclipse buildpath自动获取内部目录的所有JAR

The reason it works like this for your JSP's is because that is how the Dynamic Web Project was made to behave. 它为你的JSP工作的原因是因为动态Web项目的行为方式就是这样。

"If you remove a library path entry but not the JAR file, the library entry will be re-added to the path automatically." “如果删除库路径条目但不删除JAR文件,则库条目将自动重新添加到路径中。” from http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.wst.webtools.doc.user/topics/ccwebprj.html 来自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 ; 您可以采用Maven并使用Maven Eclipse插件 ; this plugin would update your classpath whenever you add a dependency. 每当添加依赖项时,此插件都会更新您的类路径。 There may be a similar plugin for Ivy . Ivy可能有一个类似的插件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 有什么方法可以将我的自定义名称放入我将要放在struts应用程序的WEB-INF文件夹中的LIB文件夹中? - Is there any way to put my custom name to LIB folder which i am going to place in WEB-INF folder of struts application? 如何在我的构建中将导入的jar文件添加到eclipse中的web-inf / lib? - How can I add imported jar files to web-inf/lib in eclipse for my build? 如何让 Weblogic 10 更喜欢 myApp.war:/WEB-INF/lib/ 中的 jars 而不抛出 VerifyErrors? - How do I make Weblogic 10 prefer the jars in myApp.war:/WEB-INF/lib/ without throwing VerifyErrors? 在Eclipse中,如何在WEB-INF / lib文件夹下添加jar文件夹? - In Eclipse, how to add a folder of jars under WEB-INF/lib folder? 使用Ant Build脚本创建WarFile时,如何在WEB-INF / lib文件夹中包含Classpath jars - How to include Classpath jars in WEB-INF/lib Folder while creating a WarFile using Ant Build Script 如何将 JAR 文件添加到 Eclipse 中的 web-inf/lib 文件夹? - How can I add JAR files to the web-inf/lib folder in Eclipse? 如何将maven托管依赖项复制到war \ web-inf \ lib中,以便在Eclipse中以调试模式运行我的GWT 2.0应用程序? - How do I get maven managed dependencies copied into war\web-inf\lib so I can run my GWT 2.0 app in debug mode within Eclipse? 使用Eclipse / Tomcat自动将第三方jar添加到WEB-INF / lib - Adding 3rd party jars to WEB-INF/lib automatically using Eclipse/Tomcat 我的Maven项目没有将依赖项导入WEB-INF / lib文件夹 - My maven project does not import dependencies to WEB-INF/lib folder Maven不会在WEB-INF / lib文件夹中复制spring jars - Maven does not copy spring jars in WEB-INF/lib folder
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM