在 Eclipse .project 文件中存储自定义项目相关数据
我正在从事的项目有它自己的性质。该项目有自己的首选项,可以由用户设置。我想将这些首选项存储在 .project 文件中 - 它将允许在用户之间轻松交换项目(想要与其他人共享项目的用户不必导出它)。 问题是 - 是否可以在 Eclipse 项目的 .project
文件中存储附加(自定义)数据?
The project I'm working on has its own nature. The project has its own preferences that can be set by a user. I would like to store these preferences in the .project file - it would allow to easily exchange of the project between the users (the user who wants to share the project with someone else doesn't have to export it).
The question is - is it possible to store additional (custom) data in the .project
file in Eclipse's project?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一般来说,这应该是可能的,但不建议这样做,也不是常见的做法。
.project
文件绑定到接口org.eclipse.core.resources.IProjectDescription
。如果您需要可共享的项目特定设置,请像所有其他 Eclipse 插件一样,例如 JDT、PDE 等。创建您自己的.settings/.myspecificprops
文件,使用此文件对您的值进行序列化并使其可通过您的 org.eclipse.core.resources.IProjectNature 实现进行访问。写入的文件也位于项目文件夹中,因此无需导出它们。In general it should be possible, but this is not recommended and is not common practise. The
.project
file is bound to the interfaceorg.eclipse.core.resources.IProjectDescription
. If you need shareable project-specific settings does it like all other Eclipse plugins, e.g. JDT, PDE, etc. Create your own.settings/.myspecificprops
file use this file for serialization of your values and make that accessible through yourorg.eclipse.core.resources.IProjectNature
implementation. The written files are also located in the project-folder, so that there is no need to export them.