如何将一个 Eclipse 项目作为库导入另一个项目?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28263270/
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
How to import one Eclipse project as a library into another?
提问by Andreas Hartmann
I would like to use one of my eclipse projects in another one. Is there a 'smooth' way to do that, without having to export one as a jar file and importing it into another? Especially since I work on both project simultaneously, I would like the latest changes from the imported project to be automatically built and imported into the other one. Is that possible?
我想在另一个项目中使用我的一个 Eclipse 项目。有没有一种“平滑”的方法可以做到这一点,而不必将一个文件导出为 jar 文件并将其导入另一个文件?特别是因为我同时处理这两个项目,我希望自动构建导入项目的最新更改并将其导入到另一个项目中。那可能吗?
回答by Kostya Buts
It is possible. Right click on your project -> Build Path -> Configure Build Path. Switch to the Projects tab and add one. It will work as a library.
有可能的。右键单击您的项目 -> 构建路径 -> 配置构建路径。切换到 Projects 选项卡并添加一个。它将作为图书馆工作。
P.S. You might also want to check this: Creating a java library with Eclipse
PS您可能还想检查一下:Creating a java library with Eclipse
回答by Rumesh Eranga Hapuarachchi
Answer to this questionexplains how to import your own library in eclipse.
这个问题的答案解释了如何在 eclipse 中导入您自己的库。
Quoting from the answer.
引自答案。
Just have "Project" reference your "Library", on windows the process is (using menu / tab names)
- Go to: Project -> Properties -> Java Build Path -> Projects
- Client Add...
- Select your "Library" project from the list
- Click Ok
- Click the other Ok Now your done and you can use import for classes in your "Library"
只需让“项目”引用您的“库”,在 Windows 上该过程是(使用菜单/选项卡名称)
- 转到:项目 -> 属性 -> Java 构建路径 -> 项目
- 客户端添加...
- 从列表中选择您的“库”项目
- 单击确定
- 单击另一个 Ok 现在您完成了,您可以在“库”中使用导入类