项目中有罐子的文件夹 [英] Folder with jars in project

查看:94
本文介绍了项目中有罐子的文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我处理小型桌面项目时,我曾经在项目的根目录中创建 lib 文件夹,其中保留了所有项目的jar依赖项。然后,我使用配置构建路径-> -> 添加JAR ... 将来自此文件夹的所有jar手动添加到buildpath / classpath。而且由于 Add JARs ... (与 Add external JARs 不同)使用相对路径,因此该项目具有可移植性,这对我来说很重要。

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时,我都需要在项目buildpath设置中手动添加/删除该jar( (当然,我经常忘记这样做)。

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集成有时令人沮丧,因此我更喜欢在这些项目中避免使用它),所以请不要建议这样做就像我提到的,这些都是桌面项目,因此我的项目中没有 WEB-INF / lib 文件夹,该文件夹通常由Java EE插件自动处理。 / 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 rel = nofollow> Apache IvyDE类路径容器。

但是向类路径添加新库很简单,并且快速:

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 !

这篇关于项目中有罐子的文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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