We have a a product developed on Windows for years. The product is composed of one Eclipse workspace and about 20 projects. On Windows, we ask every developer check out projects into d:\dev\product folder, and copy a unified Workspace to d:\dev\prod_workspace. This way, whenever a new machine is set, we simply copy files to the same folder, and we can start working immediately.
我们在Windows上开发了多年的产品。该产品由一个Eclipse工作区和大约20个项目组成。在Windows上,我们要求每个开发人员将项目签入d:\ dev \ product文件夹,并将统一的工作区复制到d:\ dev \ prod_workspace。这样,无论何时设置新机器,我们只需将文件复制到同一文件夹,我们就可以立即开始工作。
Now we need to move our development environment to Linux and Mac. But there's no D:\ on Unix. And home folder for Linux is mostly like /home/username and /Users/username for Mac. We found Eclipse keeps absolute path in workspace when referring to projects, so simply copy workspace over does not work anymore. Even when we manually create/configure workspace on a Linux machine, it still cannot be copied over to another user, because the absolute path is changed.
现在我们需要将开发环境转移到Linux和Mac。但在Unix上没有D:\。 Linux的主文件夹主要是/ home /用户名和/用户/ Mac用户名。我们发现Eclipse在引用项目时保留了工作空间中的绝对路径,因此简单地复制工作空间不再起作用。即使我们在Linux机器上手动创建/配置工作区,它仍然无法复制到另一个用户,因为绝对路径已更改。
I guess our goal is to allow easy setup of development environment. Do you have any suggestion to move eclipse workspace around?
我想我们的目标是允许轻松设置开发环境。你有什么建议可以移动eclipse工作区吗?
6 个解决方案
#1
3
I develop an Eclipse based product for Mac and WIndows (haven't tried Linux).
我为Mac和WIndows开发了一个基于Eclipse的产品(还没有尝试过Linux)。
The solution I found to work best is to actually go and manually check out the projects in the workspace on each machine directly from source control. While the project structure does convert between platforms, any attaches, such as version-control stuff does not. I am not sure why, but I guess each thing has its kinks. You may be able to able to hasten things a little by creating a project working set (or whatever it's called, I think it's a PSF file) for a platform, and then reuse it on all platforms.
我发现最好的解决方案是直接从源代码控制中手动检查每台机器上工作区中的项目。虽然项目结构确实在平台之间进行转换,但任何附件(例如版本控制的东西)都没有。我不知道为什么,但我想每件事都有它的问题。您可以通过为平台创建项目工作集(或其他所谓的,我认为它是PSF文件)来加速一些事情,然后在所有平台上重复使用它。
Another problem is that Eclipse versions are not 100% compatible. One of the problems I have is with manifest files for plugins, which have different semantics (e.g., what to do with exported packages that don't actually exist) in each platform, causing a headache.
另一个问题是Eclipse版本不是100%兼容的。我遇到的一个问题是插件的清单文件,它们在每个平台中都有不同的语义(例如,如何处理实际上不存在的导出包),这让人头疼。
Finally, be away that Java on Mac and PC are not identical. In fact, Eclipse has two versions for the Mac. I usually end up running and compiling on Java 5 on the mac, which does have some incompatibilities with Java 6.
最后,要远离Mac和PC上的Java不一样。事实上,Eclipse有两个版本的Mac。我通常最终在mac上运行和编译Java 5,它与Java 6有一些不兼容的地方。
#2
3
I have ported my eclipse project from windows xp to RHEL(never tried Mac)
我已将我的eclipse项目从windows xp移植到RHEL(从未尝试过Mac)
Your task can be accomplished in the following steps :-
您的任务可以通过以下步骤完成: -
- Use workspace variables in your project code rather than absolute path.
- 在项目代码中使用工作空间变量而不是绝对路径。
- Shift your workspace to some location in linux as /Workspace or if you want to keep it user specific make the workspace folder as /home/user_name/Workspace.
- 将工作区转移到linux中的某个位置作为/ Workspace,或者如果要保持用户特定的位置,请将工作区文件夹设置为/ home / user_name / Workspace。
- There is an option to change all the \ of windows to / in linux. The option can be found under the file menu in eclipse.
- 有一个选项可以将所有窗口更改为/在linux中。该选项可以在eclipse的文件菜单下找到。
- Change the settings of where to find classpath directories, the options can be found by just right clicking on the project menu in the project viewer panel.
- 更改查找类路径目录的位置设置,只需右键单击项目查看器面板中的项目菜单即可找到这些选项。
- There is an option to build the project clean from scratch. You just have to click on the option and eclipse would re-compile the project.
- 可以选择从头开始构建项目。你只需要点击选项,eclipse就会重新编译项目。
Once all this is done, and all your database connections have been successfully ported to linux, you would have a working project running in linux as well.
完成所有这些操作后,所有数据库连接都已成功移植到linux,您也可以在linux中运行一个工作项目。
#3
0
I can think of two ways to do this:
我可以想到两种方法:
- Use workspace variables in Eclipse to point to the exact location where the workspace sits, if you need that. Then the developer can put everything in the workspace on Windows, Unix, whatever, then define the variable and you're done, or
- 如果需要,可以使用Eclipse中的工作空间变量指向工作空间所在的确切位置。然后,开发人员可以将所有内容放在Windows,Unix等工作区中,然后定义变量并完成,或者
- If compilation is always done from within Eclipse, meaning you don't truly need any absolute paths anywhere, then change the projects to all use relative paths and check the Eclipse classpaths, etc, into source control. Thus, when a developer checks out everything in Eclipse, the classpath and
.project
file will be at the root level in the project and all paths will be pre-defined. - 如果总是在Eclipse中完成编译,这意味着您并不真正需要任何绝对路径,那么将项目更改为所有使用相对路径并将Eclipse类路径等检查到源代码控制中。因此,当开发人员检出Eclipse中的所有内容时,classpath和.project文件将位于项目的根级别,并且所有路径都将被预定义。
For option #2, you may need to have multiple .project
or .classpath
files, and have the developer copy the appropriate one into location. That is, copy .classpath.win
into .classpath
for Eclipse's use.
对于选项#2,您可能需要具有多个.project或.classpath文件,并让开发人员将相应的文件复制到位。也就是说,将.classpath.win复制到.classpath中以供Eclipse使用。
#4
0
If you check out the projects from a source repository, then consider using Team -> ProjectSets to handle these.
如果从源存储库中签出项目,请考虑使用Team - > ProjectSet来处理这些项目。
Preferences can be saved in a file and loaded.
首选项可以保存在文件中并加载。
We tried classpath variables and loathed them. Now we just have everything in single projects in the source repository.
我们尝试了类路径变量并厌恶它们。现在我们只在源存储库中的单个项目中拥有所有内容。
#5
0
Use the Workspace Preference Transferrer plugin
使用Workspace Preference Transferrer插件
This allows you to transfer the workspace settings from a given workspace to another via new options in the 'switch workspaces' dialog.
这允许您通过“切换工作区”对话框中的新选项将工作区设置从给定工作区传输到另一个工作区。
#6
0
I'll share my own solution:
我将分享我自己的解决方案:
Zip the workspace. Just zip the entire file and then transfer it over. Then, all you need to do is delete the default drive reference:D:\
...or whatever ends up appearing in the beginning of your file name. Then all you need to do is drag it over to the new empty workspace on your newly downloaded Eclipse.
压缩工作区。只需压缩整个文件,然后将其传输。然后,您需要做的就是删除默认驱动器引用:D:\ ...或最终出现在文件名开头的任何内容。然后,您需要做的就是将其拖到新下载的Eclipse上的新空工作区。
#1
3
I develop an Eclipse based product for Mac and WIndows (haven't tried Linux).
我为Mac和WIndows开发了一个基于Eclipse的产品(还没有尝试过Linux)。
The solution I found to work best is to actually go and manually check out the projects in the workspace on each machine directly from source control. While the project structure does convert between platforms, any attaches, such as version-control stuff does not. I am not sure why, but I guess each thing has its kinks. You may be able to able to hasten things a little by creating a project working set (or whatever it's called, I think it's a PSF file) for a platform, and then reuse it on all platforms.
我发现最好的解决方案是直接从源代码控制中手动检查每台机器上工作区中的项目。虽然项目结构确实在平台之间进行转换,但任何附件(例如版本控制的东西)都没有。我不知道为什么,但我想每件事都有它的问题。您可以通过为平台创建项目工作集(或其他所谓的,我认为它是PSF文件)来加速一些事情,然后在所有平台上重复使用它。
Another problem is that Eclipse versions are not 100% compatible. One of the problems I have is with manifest files for plugins, which have different semantics (e.g., what to do with exported packages that don't actually exist) in each platform, causing a headache.
另一个问题是Eclipse版本不是100%兼容的。我遇到的一个问题是插件的清单文件,它们在每个平台中都有不同的语义(例如,如何处理实际上不存在的导出包),这让人头疼。
Finally, be away that Java on Mac and PC are not identical. In fact, Eclipse has two versions for the Mac. I usually end up running and compiling on Java 5 on the mac, which does have some incompatibilities with Java 6.
最后,要远离Mac和PC上的Java不一样。事实上,Eclipse有两个版本的Mac。我通常最终在mac上运行和编译Java 5,它与Java 6有一些不兼容的地方。
#2
3
I have ported my eclipse project from windows xp to RHEL(never tried Mac)
我已将我的eclipse项目从windows xp移植到RHEL(从未尝试过Mac)
Your task can be accomplished in the following steps :-
您的任务可以通过以下步骤完成: -
- Use workspace variables in your project code rather than absolute path.
- 在项目代码中使用工作空间变量而不是绝对路径。
- Shift your workspace to some location in linux as /Workspace or if you want to keep it user specific make the workspace folder as /home/user_name/Workspace.
- 将工作区转移到linux中的某个位置作为/ Workspace,或者如果要保持用户特定的位置,请将工作区文件夹设置为/ home / user_name / Workspace。
- There is an option to change all the \ of windows to / in linux. The option can be found under the file menu in eclipse.
- 有一个选项可以将所有窗口更改为/在linux中。该选项可以在eclipse的文件菜单下找到。
- Change the settings of where to find classpath directories, the options can be found by just right clicking on the project menu in the project viewer panel.
- 更改查找类路径目录的位置设置,只需右键单击项目查看器面板中的项目菜单即可找到这些选项。
- There is an option to build the project clean from scratch. You just have to click on the option and eclipse would re-compile the project.
- 可以选择从头开始构建项目。你只需要点击选项,eclipse就会重新编译项目。
Once all this is done, and all your database connections have been successfully ported to linux, you would have a working project running in linux as well.
完成所有这些操作后,所有数据库连接都已成功移植到linux,您也可以在linux中运行一个工作项目。
#3
0
I can think of two ways to do this:
我可以想到两种方法:
- Use workspace variables in Eclipse to point to the exact location where the workspace sits, if you need that. Then the developer can put everything in the workspace on Windows, Unix, whatever, then define the variable and you're done, or
- 如果需要,可以使用Eclipse中的工作空间变量指向工作空间所在的确切位置。然后,开发人员可以将所有内容放在Windows,Unix等工作区中,然后定义变量并完成,或者
- If compilation is always done from within Eclipse, meaning you don't truly need any absolute paths anywhere, then change the projects to all use relative paths and check the Eclipse classpaths, etc, into source control. Thus, when a developer checks out everything in Eclipse, the classpath and
.project
file will be at the root level in the project and all paths will be pre-defined. - 如果总是在Eclipse中完成编译,这意味着您并不真正需要任何绝对路径,那么将项目更改为所有使用相对路径并将Eclipse类路径等检查到源代码控制中。因此,当开发人员检出Eclipse中的所有内容时,classpath和.project文件将位于项目的根级别,并且所有路径都将被预定义。
For option #2, you may need to have multiple .project
or .classpath
files, and have the developer copy the appropriate one into location. That is, copy .classpath.win
into .classpath
for Eclipse's use.
对于选项#2,您可能需要具有多个.project或.classpath文件,并让开发人员将相应的文件复制到位。也就是说,将.classpath.win复制到.classpath中以供Eclipse使用。
#4
0
If you check out the projects from a source repository, then consider using Team -> ProjectSets to handle these.
如果从源存储库中签出项目,请考虑使用Team - > ProjectSet来处理这些项目。
Preferences can be saved in a file and loaded.
首选项可以保存在文件中并加载。
We tried classpath variables and loathed them. Now we just have everything in single projects in the source repository.
我们尝试了类路径变量并厌恶它们。现在我们只在源存储库中的单个项目中拥有所有内容。
#5
0
Use the Workspace Preference Transferrer plugin
使用Workspace Preference Transferrer插件
This allows you to transfer the workspace settings from a given workspace to another via new options in the 'switch workspaces' dialog.
这允许您通过“切换工作区”对话框中的新选项将工作区设置从给定工作区传输到另一个工作区。
#6
0
I'll share my own solution:
我将分享我自己的解决方案:
Zip the workspace. Just zip the entire file and then transfer it over. Then, all you need to do is delete the default drive reference:D:\
...or whatever ends up appearing in the beginning of your file name. Then all you need to do is drag it over to the new empty workspace on your newly downloaded Eclipse.
压缩工作区。只需压缩整个文件,然后将其传输。然后,您需要做的就是删除默认驱动器引用:D:\ ...或最终出现在文件名开头的任何内容。然后,您需要做的就是将其拖到新下载的Eclipse上的新空工作区。