Eclipse:项目中包含jars的文件夹 [英] Eclipse: folder with jars in project
问题描述
当我在小型桌面项目上工作时,我用来在项目的根目录中创建 lib
文件夹,其中保存所有项目的jar依赖项。然后我使用配置构建路径
- > 库
- > 添加JARs ...
手动将此文件夹中的所有jar添加到buildpath / classpath。因为
添加JARs ...
(不同于添加外部JAR
)使用相对路径,项目是可移植的,什么是
When I work on small desktop projects I used to create lib
folder in my project's root where I keep all project's jar dependencies. Then I use Configure Build Path
-> Libraries
-> Add JARs...
to manually add all jars from this folder to buildpath/classpath. And because Add JARs...
(unlike Add external JARs
) uses relative paths, the project is portable, what is important for me.
问题是每次从我的 lib
文件夹添加或删除一个jar我需要手动添加/删除这个jar在项目buildpath设置(当然我经常忘记这样做)。
The problem is that each time I add or remove a jar from my lib
folder I need to manually add/remove this jar in project buildpath settings (and of course I often forget to do so).
有一种方法,只是通知Eclipse这是一个文件夹,我保留我的所有jar。请,添加所有jar从那里自动buildpath / classpath ?我试图把这个文件夹作为类文件夹(添加类文件夹...
),但它不工作这样:(。
Is there a way to just inform Eclipse that "This is a folder where I keep all of my jars. Please, add all the jars from there automatically to buildpath/classpath"? I tried to treat this folder as a class folder (Add class folder...
) but it doesn't work that way :(.
PS我知道Maven和Eclipse-Maven集成,但我想保持我的小项目的简单(Maven集成有时令人沮丧,所以我宁愿避免在这些项目),所以请不要建议正如我所提到的,这些是桌面项目,因此在我的项目中没有通常由Java EE插件自动处理的 WEB-INF / lib
文件夹。 / p>
P.S. I know about Maven and Eclipse-Maven integration but I want to keep my small project's simple (Maven integration is sometimes frustrating so I prefer to avoid it in these projects), so please don't suggest this in answer. Also as I mentioned, these are desktop projects, so there is no WEB-INF/lib
folder in my project that is usually automatically handled by Java EE plugins.
推荐答案
您可以尝试使用类路径容器,看看这里为例。
you can try with a classpath container, take a look here for an example .
a href =http://ant.apache.org/ivy/ivyde/history/trunk/cp_container.html =nofollow> Apache IvyDE类路径容器
Take a look also at the Apache IvyDE classpath container .
但是添加一个新库到类路径是简单和快速如:
However adding a new library to the classpath is simple and quick as :
Right click on it ---> Build Path ---> Add To Build Path
编辑
这个轻量级插件应该做什么你想要的!
This lightweight plugin should do exactly what you want !
这篇关于Eclipse:项目中包含jars的文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!