java eclipse构建路径选项问题
我有一个关于 Eclipse 的问题(我正在使用 Helios)。
当项目依赖于各种库时,我们通过构建路径对话框将它们添加到类路径中。
但在同一个对话框中,有一个项目选项卡(构建路径上的必需项目)。
我不清楚何时有人会将这样的引用从一个项目添加到另一个项目。
我的意思是,如果项目 A 需要项目 B 的功能,那么我们可以从项目 B 中制作一个 jar 并在项目 A 中使用它。
但是,我们什么时候会添加从项目A到项目B的引用,以便在项目A的构建路径中需要项目B?
有人可以举个例子吗?
谢谢你!
I have a question on Eclipse (I am using Helios).
When a project depends on various libraries, we add them to the classpath via the Build Path Dialog.
In the same dialog though, there is a tab for Projects (Required Projects on the build path).
It is not clear to me, when someone would add such a reference from one project to another.
I mean, if projectA needs functionality from projectB, then we can make a jar out of projectB and use it in projectA.
But when, would we add then, a reference from projectA to projectB, in order to need projectB in the build path of projectA?
Could someone please give an example?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
嗯,依赖项目有两个原因。
更新:我想到了第三个,甚至可能比前两个更好。在同一屏幕中有一个“排序和导出”选项卡,您可以在其中选择导出项目类路径的哪些元素。这里“导出”的意思正是,如果项目 B 配置为将项目 A 作为依赖项,那么它会自动将项目 A 中的所有导出库添加到自己的类路径中。因此,如果项目 A 有很多第三方库,则不必手动将它们添加到项目 B 的类路径中。
Well, there are two reasons for depending on a project.
Update: I thought of a third one, possibly even better than the first two. There is an "Order and Export" tab in the same screen, where you can select which elements of a project's classpath are exported. And what "exported" means here is exactly that if project B is configured to have project A as a dependency, then it will automatically add all the exported libraries from project A to its own classpath. So if project A has a lot of thrid party libraries, you don't have to manually add them to project B's classpath.
“必需的项目”允许您声明项目之间的依赖关系,而无需在每次对所依赖的项目进行更改时构建 jar。
"Required Projects" allow you to state dependencies between projects without the need to build a jar each time you make a change to the project you depend upon.
“项目依赖性”的一种使用(对我来说很好,对其他人来说;也许是亵渎的)是当你有一个单独的项目用于单元测试时。使单元测试项目依赖于待测试项目。当然,只有当您不是 Maven 或 Hudson 或诸如此类的用户(像我一样)时,这才好。并不是说废话、废话、废话都是坏事。
One (for me nice, for others; perhaps, blasphemous) use of the "Project Dependancy" is when you have a seperate project for unit tests. Make the unit test project depend on the to-be-tested project. Of course, this is only nice if you are not a maven or hudson or blah, blah, blah user (like me). Not that blah, blah, blah are bad things.