Eclipse:我应该为每个项目创建一个工作区吗?

时间:2023-01-17 18:06:19

I am simply wondering whether it is best to put all of my Eclipse projects into one workspace, or do a 1 workspace per 1 project. I am just a solo developer, for hobby more or less, but the apps I create do actually have production versions that are running on rather frequent cron jobs, so its almost like an amateur production environment.

我只是想知道是否最好将所有Eclipse项目放入一个工作区,或者每个项目执行一个工作区。我只是一个单独的开发人员,或多或少的爱好,但我创建的应用程序确实有生产版本在相当频繁的cron作业上运行,所以它几乎像一个业余生产环境。

The only problems I have noticed so far is for exporting JARs, I have the potential to include source files from other projects which seems like it could get messy.

到目前为止我注意到的唯一问题是导出JAR,我有可能包含来自其他项目的源文件,看起来它可能会变得混乱。

14 个解决方案

#1


25  

I create Eclipse workspaces around products, because for me, a product can have multiple projects within them, for example like having core libraries compiled into one jar in a project, this is used by other projects.

我围绕产品创建Eclipse工作区,因为对我来说,产品可以包含多个项目,例如将核心库编译到项目中的一个jar中,其他项目使用它。

In terms of production environment, you would want products running in different directory structures, much cleaner that way. And in eclipse the workspace creates a directory with workspace name. So, create workspaces based on product/app rather than one or more projects within them.

在生产环境方面,您会希望产品在不同的目录结构中运行,更加清晰。在eclipse中,工作空间创建一个具有工作空间名称的目录。因此,基于产品/应用程序而不是其中的一个或多个项目创建工作区。

#2


21  

I used to keep separate workspaces, but got tired of the difficulty in keeping settings consistent between them. Now what I do is create working sets for different projects and change the current window working set to filter out everything except what I want to work on. So far this has worked fine for me.

我曾经保持不同的工作空间,但厌倦了保持它们之间的设置一致的困难。现在,我所做的是为不同的项目创建工作集,并更改当前窗口工作集,以过滤除我想要处理的所有内容之外的所有内容。到目前为止,这对我来说很好。

Since each project can have multiple working sets, and the window working set can be any combination of working sets, it's quite easy to only see what you want at any given time this way.

由于每个项目可以有多个工作集,并且窗口工作集可以是工作集的任意组合,因此很容易在任何给定时间以这种方式查看您想要的内容。

#3


6  

If the projects are interrelated (i.e. have dependencies on each other) then it quite often makes sense to have them in the same workspace. Also, if you are working on several projects to solve a related problem, the same applies.

如果项目是相互关联的(即彼此依赖),那么将它们放在同一个工作区中通常是有意义的。此外,如果您正在处理几个项目来解决相关问题,同样适用。

You will waste a lot of time changing workspaces unnecessarily otherwise, especially when the IDE will immediately show you the impact the changes in one project has on another.

否则,您将浪费大量时间不必要地更改工作空间,尤其是当IDE将立即显示一个项目中的更改对另一个项目的更改的影响时。

#4


6  

Not only do I keep separate workspaces for each project but I keep separate copies of Eclipse also. This is because I typically have to put projects on ice for long periods and return to them (with little notice) and they absolutely must build. I can't take the chance that some plugin I've installed for my latest project (maven based) will interfere with the build process of one of the legacy systems (ant based). For the record I do document the eclipse environment for those legacy systems but I don't have time to mess with eclipse when patching a production bug.

我不仅为每个项目保留了单独的工作空间,而且还保留了Eclipse的单独副本。这是因为我通常不得不将项目长时间放在冰上并返回给他们(几乎没有注意到),他们绝对必须建立。我不能冒这个为我的最新项目(基于maven)安装的插件会干扰其中一个遗留系统(基于ant)的构建过程的机会。为了记录,我记录了那些遗留系统的eclipse环境,但是在修补生产错误时我没有时间搞乱eclipse。

#5


3  

I would use separate workspaces for different "groups" of projects. For example you might want to combine your main app project AND the unit testing project together in the same workspace.

我会为不同的“组”项目使用单独的工作区。例如,您可能希望将主应用程序项目和单元测试项目组合在同一工作区中。

#6


3  

Maybe I'm unlucky, but Eclipse often (once a month, say) dies on startup, typically in the "Initializing Java Tooling" stage. The recommended solution seems to be to create a new workspace. If you have all your projects in one workspace, this can be a pain. I think smaller workspaces may mean the crash is less likely to occur.

也许我运气不好,但Eclipse经常(比如说每月一次)在启动时死掉,通常在“初始化Java工具”阶段。推荐的解决方案似乎是创建一个新的工作区。如果您在一个工作区中拥有所有项目,这可能会很痛苦。我认为较小的工作空间可能意味着崩溃不太可能发生。

#7


3  

As the Preferences are workspace-specific, I tend to have a enormous workspace open - I'm too lazy to sync some settings between workspaces (e.g. repositories...).

由于首选项是特定于工作空间的,我倾向于打开一个巨大的工作空间 - 我懒得在工作空间之间同步一些设置(例如存储库......)。

On the other having too much projects open in a single workspace can slow down Eclipse - so the least I have to do is to close projects I'm not working with. I manage a lot of relative short-term projects (at most one month) in Eclipse, that reside in the same workspace (and in most cases the same repository), so this setup gives me a bigger flexibility.

另一方面,在一个工作区中打开太多项目可能会减慢Eclipse的速度 - 所以我至少要做的是关闭我不使用的项目。我在Eclipse中管理了许多相对短期项目(最多一个月),这些项目位于同一个工作区(在大多数情况下是相同的存储库),因此这个设置为我提供了更大的灵活性。

If you have several, interrelated projects, then keep them in the same workspace. If you can identify group of projects, that are always used together, but the groups are used independently, then put such project sets into different workspaces. In that case that should be the logical structure.

如果您有多个相互关联的项目,请将它们保存在同一工作区中。如果您可以识别总是一起使用的项目组,但这些组是独立使用的,那么将这些项目集放入不同的工作区。在那种情况下应该是逻辑结构。

#8


3  

We have a situation where we have several projects, some on branches, which frankly is too impractical to keep in the same workspace - and working sets are a joke. Unfortunately. Also having projects open you do not use, may accidentially be chosen from completion menues, etc. Error prone.

我们有一个情况,我们有几个项目,一些在分支机构,坦率地说,在同一个工作区中保持不切实际 - 而且工作集是一个笑话。不幸。如果项目打开你不使用,可能会在意外选择完成菜单等。容易出错。

The really nifty feature for us, was when Team -> Project Sets were added (in Eclipse 3.3 I believe) as this allowed us to have a single file describing the many projects making up the whole application, which can be imported in Eclipse with Team->Import. Need a given project? Check it out of CVS, locate the projectSet.psf file inside of it, and import THAT.

对我们来说真正漂亮的功能就是添加了团队 - >项目集(我相信在Eclipse 3.3中),因为这样我们就可以拥有一个文件来描述组成整个应用程序的许多项目,这些项目可以在团队中导入Eclipse - >导入。需要一个给定的项目?从CVS中检查它,找到它内部的projectSet.psf文件,然后导入它。

This has proven to work well for us.

事实证明这对我们很有用。

#9


3  

I have one workspace per Type of project. Ex: Plain Java, Web Application, Python etc.

每个项目类型我有一个工作区。例如:普通Java,Web应用程序,Python等。

The reason being I can share libraries that are similar without copying or pointing to them. Also, I close the unrelated projects from eclipse to avoid clutter.

原因是我可以共享相似的库而无需复制或指向它们。另外,我关闭了eclipse中不相关的项目以避免混乱。

#10


2  

I have all my projects in single workspace and use working sets to manage them.

我将所有项目都放在单个工作区中,并使用工作集来管理它们。

#11


1  

Up to you! I've always found keeping the related versions of different projects, which belong to the same release in a given workspace a cleaner approach. That way, I could switch between workspaces whenever I need to refer to something in a separate release, and switch back to the current release workspace. It also saves me from the hassle of checking-out, or browsing the repository.

由你决定!我总是发现保留不同项目的相关版本,这些版本在给定工作空间中属于同一版本,是一种更清晰的方法。这样,每当我需要在单独的版本中引用某些内容时,我就可以在工作区之间切换,并切换回当前版本工作区。它还使我免于签出或浏览存储库的麻烦。

#12


1  

You may also want to keep in mind that you can open multiple instances of eclipse as long as they are looking at different workspaces. Not sure if that is important to you, but I like doing that from time to time.

您可能还需要记住,只要他们查看不同的工作区,您就可以打开多个eclipse实例。不确定这对你来说是否重要,但我喜欢不时这样做。

#13


1  

I like to use several decoupled workspaces (which differ depending on the type of project), which import projects from various locations. Easy to move things around, without creating a ton of similar workspaces. Plays nice with my SCM too.

我喜欢使用几个解耦的工作空间(根据项目的类型而不同),这些工作空间从不同的位置导入项目。易于移动,无需创建大量类似的工作空间。我的SCM也很好玩。

#14


1  

Depends on how many projects do you work?If you work on many projects, I'd use same workspace, because if you use several you can easily forget what is where and that can be frustrating to say at least. However I always use different workspace for different programming languages that way its less confusing, when you're in JAVA workspace you think JAVA :D

取决于你工作了多少个项目?如果你在很多项目上工作,我会使用相同的工作区,因为如果你使用多个项目,你可以很容易地忘记在哪里,至少可以说是令人沮丧的。但是我总是为不同的编程语言使用不同的工作区,这样就不那么容易混淆了,当你在JAVA工作区时,你认为JAVA:D

#1


25  

I create Eclipse workspaces around products, because for me, a product can have multiple projects within them, for example like having core libraries compiled into one jar in a project, this is used by other projects.

我围绕产品创建Eclipse工作区,因为对我来说,产品可以包含多个项目,例如将核心库编译到项目中的一个jar中,其他项目使用它。

In terms of production environment, you would want products running in different directory structures, much cleaner that way. And in eclipse the workspace creates a directory with workspace name. So, create workspaces based on product/app rather than one or more projects within them.

在生产环境方面,您会希望产品在不同的目录结构中运行,更加清晰。在eclipse中,工作空间创建一个具有工作空间名称的目录。因此,基于产品/应用程序而不是其中的一个或多个项目创建工作区。

#2


21  

I used to keep separate workspaces, but got tired of the difficulty in keeping settings consistent between them. Now what I do is create working sets for different projects and change the current window working set to filter out everything except what I want to work on. So far this has worked fine for me.

我曾经保持不同的工作空间,但厌倦了保持它们之间的设置一致的困难。现在,我所做的是为不同的项目创建工作集,并更改当前窗口工作集,以过滤除我想要处理的所有内容之外的所有内容。到目前为止,这对我来说很好。

Since each project can have multiple working sets, and the window working set can be any combination of working sets, it's quite easy to only see what you want at any given time this way.

由于每个项目可以有多个工作集,并且窗口工作集可以是工作集的任意组合,因此很容易在任何给定时间以这种方式查看您想要的内容。

#3


6  

If the projects are interrelated (i.e. have dependencies on each other) then it quite often makes sense to have them in the same workspace. Also, if you are working on several projects to solve a related problem, the same applies.

如果项目是相互关联的(即彼此依赖),那么将它们放在同一个工作区中通常是有意义的。此外,如果您正在处理几个项目来解决相关问题,同样适用。

You will waste a lot of time changing workspaces unnecessarily otherwise, especially when the IDE will immediately show you the impact the changes in one project has on another.

否则,您将浪费大量时间不必要地更改工作空间,尤其是当IDE将立即显示一个项目中的更改对另一个项目的更改的影响时。

#4


6  

Not only do I keep separate workspaces for each project but I keep separate copies of Eclipse also. This is because I typically have to put projects on ice for long periods and return to them (with little notice) and they absolutely must build. I can't take the chance that some plugin I've installed for my latest project (maven based) will interfere with the build process of one of the legacy systems (ant based). For the record I do document the eclipse environment for those legacy systems but I don't have time to mess with eclipse when patching a production bug.

我不仅为每个项目保留了单独的工作空间,而且还保留了Eclipse的单独副本。这是因为我通常不得不将项目长时间放在冰上并返回给他们(几乎没有注意到),他们绝对必须建立。我不能冒这个为我的最新项目(基于maven)安装的插件会干扰其中一个遗留系统(基于ant)的构建过程的机会。为了记录,我记录了那些遗留系统的eclipse环境,但是在修补生产错误时我没有时间搞乱eclipse。

#5


3  

I would use separate workspaces for different "groups" of projects. For example you might want to combine your main app project AND the unit testing project together in the same workspace.

我会为不同的“组”项目使用单独的工作区。例如,您可能希望将主应用程序项目和单元测试项目组合在同一工作区中。

#6


3  

Maybe I'm unlucky, but Eclipse often (once a month, say) dies on startup, typically in the "Initializing Java Tooling" stage. The recommended solution seems to be to create a new workspace. If you have all your projects in one workspace, this can be a pain. I think smaller workspaces may mean the crash is less likely to occur.

也许我运气不好,但Eclipse经常(比如说每月一次)在启动时死掉,通常在“初始化Java工具”阶段。推荐的解决方案似乎是创建一个新的工作区。如果您在一个工作区中拥有所有项目,这可能会很痛苦。我认为较小的工作空间可能意味着崩溃不太可能发生。

#7


3  

As the Preferences are workspace-specific, I tend to have a enormous workspace open - I'm too lazy to sync some settings between workspaces (e.g. repositories...).

由于首选项是特定于工作空间的,我倾向于打开一个巨大的工作空间 - 我懒得在工作空间之间同步一些设置(例如存储库......)。

On the other having too much projects open in a single workspace can slow down Eclipse - so the least I have to do is to close projects I'm not working with. I manage a lot of relative short-term projects (at most one month) in Eclipse, that reside in the same workspace (and in most cases the same repository), so this setup gives me a bigger flexibility.

另一方面,在一个工作区中打开太多项目可能会减慢Eclipse的速度 - 所以我至少要做的是关闭我不使用的项目。我在Eclipse中管理了许多相对短期项目(最多一个月),这些项目位于同一个工作区(在大多数情况下是相同的存储库),因此这个设置为我提供了更大的灵活性。

If you have several, interrelated projects, then keep them in the same workspace. If you can identify group of projects, that are always used together, but the groups are used independently, then put such project sets into different workspaces. In that case that should be the logical structure.

如果您有多个相互关联的项目,请将它们保存在同一工作区中。如果您可以识别总是一起使用的项目组,但这些组是独立使用的,那么将这些项目集放入不同的工作区。在那种情况下应该是逻辑结构。

#8


3  

We have a situation where we have several projects, some on branches, which frankly is too impractical to keep in the same workspace - and working sets are a joke. Unfortunately. Also having projects open you do not use, may accidentially be chosen from completion menues, etc. Error prone.

我们有一个情况,我们有几个项目,一些在分支机构,坦率地说,在同一个工作区中保持不切实际 - 而且工作集是一个笑话。不幸。如果项目打开你不使用,可能会在意外选择完成菜单等。容易出错。

The really nifty feature for us, was when Team -> Project Sets were added (in Eclipse 3.3 I believe) as this allowed us to have a single file describing the many projects making up the whole application, which can be imported in Eclipse with Team->Import. Need a given project? Check it out of CVS, locate the projectSet.psf file inside of it, and import THAT.

对我们来说真正漂亮的功能就是添加了团队 - >项目集(我相信在Eclipse 3.3中),因为这样我们就可以拥有一个文件来描述组成整个应用程序的许多项目,这些项目可以在团队中导入Eclipse - >导入。需要一个给定的项目?从CVS中检查它,找到它内部的projectSet.psf文件,然后导入它。

This has proven to work well for us.

事实证明这对我们很有用。

#9


3  

I have one workspace per Type of project. Ex: Plain Java, Web Application, Python etc.

每个项目类型我有一个工作区。例如:普通Java,Web应用程序,Python等。

The reason being I can share libraries that are similar without copying or pointing to them. Also, I close the unrelated projects from eclipse to avoid clutter.

原因是我可以共享相似的库而无需复制或指向它们。另外,我关闭了eclipse中不相关的项目以避免混乱。

#10


2  

I have all my projects in single workspace and use working sets to manage them.

我将所有项目都放在单个工作区中,并使用工作集来管理它们。

#11


1  

Up to you! I've always found keeping the related versions of different projects, which belong to the same release in a given workspace a cleaner approach. That way, I could switch between workspaces whenever I need to refer to something in a separate release, and switch back to the current release workspace. It also saves me from the hassle of checking-out, or browsing the repository.

由你决定!我总是发现保留不同项目的相关版本,这些版本在给定工作空间中属于同一版本,是一种更清晰的方法。这样,每当我需要在单独的版本中引用某些内容时,我就可以在工作区之间切换,并切换回当前版本工作区。它还使我免于签出或浏览存储库的麻烦。

#12


1  

You may also want to keep in mind that you can open multiple instances of eclipse as long as they are looking at different workspaces. Not sure if that is important to you, but I like doing that from time to time.

您可能还需要记住,只要他们查看不同的工作区,您就可以打开多个eclipse实例。不确定这对你来说是否重要,但我喜欢不时这样做。

#13


1  

I like to use several decoupled workspaces (which differ depending on the type of project), which import projects from various locations. Easy to move things around, without creating a ton of similar workspaces. Plays nice with my SCM too.

我喜欢使用几个解耦的工作空间(根据项目的类型而不同),这些工作空间从不同的位置导入项目。易于移动,无需创建大量类似的工作空间。我的SCM也很好玩。

#14


1  

Depends on how many projects do you work?If you work on many projects, I'd use same workspace, because if you use several you can easily forget what is where and that can be frustrating to say at least. However I always use different workspace for different programming languages that way its less confusing, when you're in JAVA workspace you think JAVA :D

取决于你工作了多少个项目?如果你在很多项目上工作,我会使用相同的工作区,因为如果你使用多个项目,你可以很容易地忘记在哪里,至少可以说是令人沮丧的。但是我总是为不同的编程语言使用不同的工作区,这样就不那么容易混淆了,当你在JAVA工作区时,你认为JAVA:D