如何组织“项目”和“解决方案”在日食中?

发布于 2024-09-25 06:35:31 字数 211 浏览 9 评论 0原文

我听说 Eclipse 工作区相当于 Visual Studio 解决方案。但我也被告知,人们通常使用一个工作空间来完成所有工作。这些明显相互矛盾的陈述是否正确?如果是,那么我们如何在 Eclipse 中创建和维护多个 VS 解决方案的等效项?

其次,对于 VS,我还将解决方案 (.sln) 文件签入源代码管理。相应地,我是否应该检查 Eclipse 工作区的 .metadata 文件夹?

I've been told that an Eclipse workspace is the equivalent of a Visual Studio solution. But I've also been told that people commonly use a single workspace for all their work. Are these apparently conflicting statements correct? If yes, how do we then create and maintain the equivalent of multiple VS solutions in Eclipse?

Secondly, in the case of VS, I check in my solution (.sln) files, too, into source control. Correspondingly, should I or should I not check in the Eclipse workspace's .metadata folder?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

分開簡單 2024-10-02 06:35:31

我不认为,Eclipse 工作区等同于 VS 解决方案。 Eclipse 工作区存储了大量有关项目、其物理位置(可能在工作区文件夹内或之外)等的元信息,甚至是工作台设置。将此信息上传到源代码管理中并不是一个好主意,因为其他开发人员可能会使用项目的其他物理位置等。Eclipse

中有一个与解决方案类似的概念(类似,但不等效):项目集。它只是一个用于将项目分组的 GUI 选项。这些集不能一起执行,并且仅在项目导航器中可见。

另一种方法是创建多个工作区文件夹,您可以使用它们作为解决方案的替代方法。这种方法的缺点是,如果您自定义 IDE(例如,通过使用首选项或通过定义源代码控制位置),则必须在每个工作区中进行这些自定义。这个问题可以使用Workspace Mechanic 工具来解决(我还没有没有尝试过,但它可以迁移这些设置)。

I don't think, the Eclipse workspace is equivalent to the VS solution. An Eclipse workspace stores a lot of meta-information about projects, their physical location (possibly in or outside of the workspace folder), etc., and even workbench settings. It is not a good idea to upload this information into source control, as it is possible that other developer uses other physical locations for the projects, etc.

There is a similar concept in Eclipse to the solutions (similar, not equivalent): Project sets. It is only a GUI option to group your projects into sets. These sets cannot be executed together, and is only visible in the Project navigator.

Another way is to create multiple workspace folders, and you can use them as an alternative to solutions. The drawback of this approach is, that if you customize the IDE (e.g. by using Preferences, or by defining source control locations), these customizations have to be made in every workspace. This issue can be handled using the Workspace Mechanic tool (I haven't tried it, but it can migrate these settings).

椒妓 2024-10-02 06:35:31

对我来说,为单个项目拥有单独的工作空间更好的主要原因是性能和清晰度。对于一个工作区中的许多项目,由于共享类路径以获取编辑器帮助,您必须关闭其他项目。编辑器使用所有项目的类路径进行内容辅助、类层次结构查找等。Eclipse

预计打开的项目是相关的。当使用像 Maven 这样的项目管理器时,一个 Maven 项目通常会被分成许多小的 Eclipse 项目。为项目提供单独的工作区是最佳实践。第二个原因是,通常您需要导入另一个相关项目来查看事情是如何完成的,然后将所有这些都放在一个工作区中会变得非常混乱。

您绝对不应该将 .metadata 文件夹提交到源代码管理中。您只提交里面的项目。因为您和其他人只会将项目检出到他们自己的工作区中。但是否应该提交 .project 文件是一个问题,因为它是个性化的且特定于 eclipse 版本,并且任何人都可以自己设置项目性质(java、spring、maven 性质等)之类的东西。项目中的.classpath文件应该提交到源代码管理,因为它们指定了类路径,再次设置它会非常耗时。

The main reason why it is better FOR ME to have a separate workspace for a single project is performance and lucidity. With many projects within one workspace, you'd have to close the other ones because of shared classpaths for editor assistance. Editor uses classpaths of all projects for content assist, class hierarchy lookup etc.

Eclipse anticipates that the open projects are related. And when using project managers like Maven, one maven project is usually divided into many little eclipse projects. It's simply a best practice to have a separate workspace for a project. Second reason is, that usually you'd need to import another related project to see how things are done and it would be terrible mess then having it all in one workspace.

You definitely shouldn't commit the .metadata folder into source control. You commit only the projects inside. Because you and others then will check out the project only into their own workspace. But it is a question whether you should commit the .project file, because it's personalized and eclipse version specific and things like project nature (java, spring, maven nature etc.) can anybody set up by himself. .classpath files in the project should be committed to the source control, because they specify classpaths, it would be very time consuming setting it up again.

用心笑 2024-10-02 06:35:31

您可以将项目分组到不同的工作区或特定的工作区中。一旦你正确管理你的设置,Non 就可能是有害的。

You can either group your projects in different workspace or in a particular workspace. Non can be harmful once you manage your settings properly.

世界等同你 2024-10-02 06:35:31

在 Eclipse 中,您可以在根项目下为子项目创建一个新目录,并将其添加到构建路径,如下所示:

在此处输入图像描述

In eclipse you can create a new directory for a sub-project under the root project and add to the build path like so:

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文