如何设置具有多个子项目的 Eclipse 项目 (OSGi-Bundles)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2616746/
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 setup an Eclipse Project with multiple Subprojects (OSGi-Bundles)
提问by stacker
Sherlogis an OSGi-based log analyzer, if I import this project as an workspace snapshot I receive lot's of projects in my workspace, but I would prefere to have them as subprojects in a project.
Sherlog是一个基于 OSGi 的日志分析器,如果我将此项目作为工作区快照导入,我会在我的工作区中收到很多项目,但我更喜欢将它们作为项目中的子项目。
The other option would be to checkout from svn, but then I face other problems (I don't know how to setup the dependencies for automatically build)
另一种选择是从 svn 结帐,但随后我面临其他问题(我不知道如何设置自动构建的依赖项)
Does anyone have an idea or good links on this topic? Thanks
有没有人有关于这个主题的想法或好的链接?谢谢
回答by Thorbj?rn Ravn Andersen
EDIT: For Eclipse 4.5 and newer please see https://stackoverflow.com/a/34134833/53897
编辑:对于 Eclipse 4.5 及更新版本,请参阅https://stackoverflow.com/a/34134833/53897
Eclipse does not support subprojects. The Eclipse way of life is one or more projects in a workspace (perhaps using work sets to avoid seeing them all).
Eclipse 不支持子项目。Eclipse 的生活方式是一个或多个工作区中的项目(可能使用工作集来避免看到所有项目)。
As a consequence we have established an approach where we switch workspaces when switching projects. Team Projects are nice for this for CVS. For git I do a separate clone for each workspace as the Maven support in Eclipse does not pick up changes in the pom hierarchy (like a new project) easily.
因此,我们建立了一种在切换项目时切换工作区的方法。团队项目非常适合 CVS。对于 git,我为每个工作区做一个单独的克隆,因为 Eclipse 中的 Maven 支持不会轻易地获取 pom 层次结构中的更改(如新项目)。
回答by gliviu
As of Eclipse 4.5 (starting from Mars M5) subprojects are supported. Either import a multi module maven project like here.
从 Eclipse 4.5(从 Mars M5 开始)支持子项目。要么像这里一样导入一个多模块 maven 项目。
Or create a directory structure like this.
或者创建一个这样的目录结构。
BaseProj
----.project
----JavaSubProject1
--------.project
--------.classpath
--------src
--------JavaSubProject2
------------.project
------------.classpath
------------src
Use 'File->Import->Existing Projects into Workspace' and import only BaseProj. It will import all projects. Be sure to activate hierarhical view in Project Explorer.
使用“文件->导入->现有项目到工作区”并仅导入 BaseProj。它将导入所有项目。确保在 Project Explorer 中激活分层视图。
Later edit - When using import dialog, check 'Search for nested projects' otherwise only BaseProj will be created.
稍后编辑 - 使用导入对话框时,选中“搜索嵌套项目”,否则只会创建 BaseProj。