如何在eclipse导出到战争时将所有外部jar添加到库中 [英] How to add all external jars to library on eclipse export to war

查看:140
本文介绍了如何在eclipse导出到战争时将所有外部jar添加到库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我已经做了一些研究,我明白我需要将我的依赖外部jar放在web-inf / lib文件夹中,以便在eclipse中运行动态Web项目。不幸的是,到目前为止,我只是在eclipse中的构建路径中导入它们,然后再次在我的测试服务器的运行时配置中导入它们。

Now that i've been doing some research I understand that I need to be placing my dependent external jars in the web-inf/lib folder for a dynamic web project in eclipse. Unfortunately until now I have simply been importing them in on the build path within eclipse and then again in the runtime config for my testing server.

是否有一种简单的方法可以在导出时将所有相关的jar复制到web-inf / lib文件夹,或者我是否必须手动查找每个,并放置它在文件夹中?在开发过程中是否有更好的方法来管理外部jar,所以我不必担心将它们导入构建路径,然后是运行时,然后是库文件夹?我已经尝试使用Project >> Properties >> Java Build Path >> Order and Export并检查所有的jar,但它们似乎仍然不会随着战争一起导出。

Is there a simple way to copy all of the dependent jars to the web-inf/lib folder upon export or do I have to manually find each one, and place it in the folder? Is there a better way to manage external jars during development so I don't have to be concerned with importing them to the build path, and then the runtime, and then the library folder? I've tried using Project >> Properties >> Java Build Path >> Order and Export and checking all the jars, but they still don't seem to export with the war.

我正在使用tomcat作为我的生产服务器,并且当我因为日志文件中的defclassnotfounderror而无法启动项目时想出了所有这些。

I am using tomcat as my production server and figured all of this out when I couldn't start the project due to defclassnotfounderror's in the log file.

推荐答案

将来,您应该始终在web-inf / lib文件夹中创建依赖项的副本。
当他们在那里时,只需右键单击它们并选择构建路径 - >添加到构建路径。

In the future you should always create a copy of your depencies in the web-inf/lib folder. When they are there just right click them and select "Build Path -> Add to Build Path".

对于当前项目,我将禁用所有当前外部生活在该文件夹之外的罐子,然后将它们复制到其中。

For your current project I would disable all current external jars that live outside of that folder and then copy them into it.

这篇关于如何在eclipse导出到战争时将所有外部jar添加到库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆