将引用的库添加到 Eclipse 中的 /lib 文件夹

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2912272/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 14:47:31  来源:igfitidea点击:

Adding referenced libraries to /lib folder in Eclipse

eclipsedependencies

提问by Alexey Romanov

Most people agree that it's a good practice to have copies of all libraries your project depends on in the /libsubfolder, so the project can be built on other computers without having to install the libraries (and you can keep the libraries in source control).

大多数人都同意,在/lib子文件夹中拥有项目所依赖的所有库的副本是一种很好的做法,因此可以在其他计算机上构建项目而无需安装库(并且您可以将库保留在源代码管理中)。

Is there a way in Eclipse to add the referenced libraries' files to the /libfolder automatically?

Eclipse 中有没有办法将引用的库/lib文件自动添加到文件夹中?

Copying and pasting files in package view doesn't seem to work for this (I get "Cannot paste the clipboard contents into the selected elements").

在包视图中复制和粘贴文件似乎对此不起作用(我收到“无法将剪贴板内容粘贴到所选元素中”)。

回答by Eugene Kuleshov

I strongly disagree about copying dependent libraries into /lib folder. It might be ok for a standalone small project, but when number of libraries grows and when there is more then one project depends on the same libraries you'll end up with lot of duplicated files in your project. Not to mention abuse of the version control system with all those large binary files. All in all it is better to use some dependency management tools, such as Ivy or Maven. The Eclipse plugins for both of those are making it practically seamless.

我强烈反对将依赖库复制到 /lib 文件夹中。对于一个独立的小项目来说可能没问题,但是当库的数量增加并且有多个项目依赖于相同的库时,您最终会在项目中得到很多重复的文件。更不用说使用所有这些大型二进制文件滥用版本控制系统了。总而言之,最好使用一些依赖管理工具,例如 Ivy 或 Maven。这两者的 Eclipse 插件使其几乎无缝连接。

回答by Gilbert Le Blanc

One way to get the library files in the /libdirectory is to right click on the /libdirectory folder and import the files. The import wizard will let you select the import source and individual files.

获取/lib目录中库文件的一种方法是右键单击/lib目录文件夹并导入文件。导入向导将让您选择导入源和单个文件。