eclipse 导入/导出项目首选项
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/881655/
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
Importing/Exporting Project Preferences
提问by Spedge
Having a bit of a problem,
有点问题,
Due to the source-control set-up we use, each bug/enhancement is worked on in a new branch. This is fine, but when in Eclipse, we need to set-up a new project for every branch.
由于我们使用的源代码控制设置,每个错误/增强都在一个新分支中进行。这很好,但是在 Eclipse 中,我们需要为每个分支设置一个新项目。
Is there any way of easily setting up default preferences for a project, or importing/exporting project preferences within Eclipse?
有没有什么方法可以轻松地为项目设置默认首选项,或者在 Eclipse 中导入/导出项目首选项?
Thanks,
谢谢,
Stuart
斯图尔特
回答by VonC
One possible solution would be to store those common preferences at the workspacelevel for Eclipse (see Manage your Eclipse environmentarticle)
一种可能的解决方案是将这些通用首选项存储在Eclipse的工作区级别(请参阅管理您的 Eclipse 环境文章)
The downside of having multiple workspaces is the need to share development preferences among them.
Since preferences are persisted on a workspace basis within Eclipse, you have to export your workspace preferences and import them to your desired workspaces(File > Export > Preferences
).
拥有多个工作区的缺点是需要在它们之间共享开发偏好。
由于首选项在 Eclipse 中以工作区为基础持续存在,因此您必须导出工作区首选项并将其导入所需的工作区(File > Export > Preferences
)。
Even if you stay in the same workspace (with several projects), you can share common settings with other developers by exporting those workspacepreferences.
即使您留在同一个工作区(有多个项目),您也可以通过导出这些工作区首选项与其他开发人员共享通用设置。
As mentioned by Fabian, the project specific settings are in .classpath
and .project
, but he left out .settings
:
正如Fabian所提到的,项目特定设置在.classpath
和 中.project
,但他遗漏了.settings
:
.settings
are for IDE project-specific settings like compiler warnings and so on.
It you want to share project-specific IDE-related settings, just copy the .settings directory from project directory to project directory.
.settings
用于 IDE 项目特定的设置,如编译器警告等。
如果要共享项目特定的 IDE 相关设置,只需将 .settings 目录从项目目录复制到项目目录即可。
Tips: copy your project launcher (created by default in <workspace>\.metadata\.plugins\org.eclipse.debug.core\.launches
) into your .settings
directory: that way, you will also share your custom project launchers.
提示:将您的项目启动器(默认在 中创建<workspace>\.metadata\.plugins\org.eclipse.debug.core\.launches
)复制到您的.settings
目录中:这样,您还将共享您的自定义项目启动器。
回答by Markus Fraenz
The above methods might work in some settings but do not address the problem of exporting a single project from your workspace including its properties for use by another person.
上述方法可能适用于某些设置,但不能解决从您的工作区导出单个项目(包括其属性以供其他人使用)的问题。
One way of doing this is to export the project folder as a zip archive as described above but also save the following file from your workspace: .metadata/.plugins/org.eclipse.core.resources/.projects/MYPROJECT/.indexes/properties.index where MYPROJECT is your project name.
执行此操作的一种方法是将项目文件夹作为上述 zip 存档导出,但也从您的工作区保存以下文件:.metadata/.plugins/org.eclipse.core.resources/.projects/MYPROJECT/.indexes/ properties.index 其中 MYPROJECT 是您的项目名称。
If you then import the project as a new project in a different workspace you can afterwards copy this file into your new workspace metadata and you will have the original project properties.
如果您随后将项目作为不同工作区中的新项目导入,您可以随后将此文件复制到您的新工作区元数据中,您将拥有原始项目属性。
回答by Fabian Steeg
The project-specificsettings (contrary to the already mentionedworkspace-specificsettings) are stored in two hidden files in the project: .classpath
and .project
, which you might be able to reuse to setup your projects.
该项目的具体设置(违背了已经提到的工作区特有的设置)都存储在项目中的两个隐藏文件:.classpath
和.project
,你也许能重用设置你的项目。
回答by KrishPrabakar
Have a look at Workspace Mechanic
看看工作区机械师