简体   繁体   English

我可以在不同的项目中共享IntelliJ Idea的设置吗?

[英]Can I share settings for IntelliJ Idea across different projects?

In the month or so that I've been using IntelliJ, I have one project that I am working in the majority of the time in which I have all of my windows, toolbar locations, etc., set up to my liking. 在我使用IntelliJ的那个月左右,我有一个项目,我在大多数时间工作,我拥有所有的窗口,工具栏位置等,根据自己的喜好设置。

I infrequently need to open other projects in IntelliJ, and I notice when doing so that all of the window locations seem to reset to the default. 我很少需要在IntelliJ中打开其他项目,我注意到这样做时所有窗口位置似乎都重置为默认值。 For example, the Structure toolbar moves back to the lower-left hand of the screen; 例如,“结构”工具栏移回屏幕的左下角; I prefer for it to be docked in the upper-right hand corner. 我更喜欢它停靠在右上角。

Can settings for window and tool locations be shared across different IntelliJ projects ? 窗口和工具位置的设置可以在不同的IntelliJ项目之间共享吗? Can I configure this once globally, and have it apply to any new project I open in IntelliJ going forward? 我可以在全球范围内配置一次,并将其应用于我在IntelliJ中打开的任何新项目吗?

Also, does anyone know where these types of settings are stored - I assume it's in the per-project IntelliJ files (such as .ipr , etc) rather than my global .settings directory? 此外,有谁知道这些类型的设置存储在哪里 - 我假设它是在每个项目的IntelliJ文件(如.ipr等)而不是我的全局.settings目录?

  1. Create new connection or go to connection "Properties" (Alt+ENTER) 创建新连接或转到连接“属性”(Alt + ENTER)
  2. Find "Project Data Sources" on top left 在左上角找到“项目数据源”
  3. Select "Make Global" in context menu 在上下文菜单中选择“Make Global”

For IntelliJ-13/14 , if you want reuse the connection to databases and the appservers you should copy-paste these files between the .idea folders of the projects. 对于IntelliJ-13/14 ,如果要重用与数据库和应用程序服务器的连接,则应将这些文件复制粘贴到项目的.idea文件夹之间。

  • dataSources.ids , dataSources.xml : Database stuff dataSources.idsdataSources.xml :数据库的东西
  • workspace.xml : All the appservers configuration workspace.xml :所有appservers配置

Yes, this sucks, but at least there is a workaround. 是的,这很糟糕,但至少有一个解决方法。


EDIT : When you create/edit the datasource there is a combobox called "scope", you can select IDE option, and this will let you reuse the datasource across many projects. 编辑 :当您创建/编辑数据源时,有一个名为“scope”的组合框,您可以选择IDE选项,这样您就可以在许多项目中重用数据源。

You are right, these settings are project specific and you can't make them default. 你是对的,这些设置是项目特定的,你不能使它们默认。 They are stored in the .idea/workspace.xml or in the <project>.iws file depending on the project format you are using. 它们存储在.idea/workspace.xml<project>.iws文件中,具体取决于您使用的项目格式。

You can try to overwrite this file in the new project with the one from the old project so that your settings are transferred. 您可以尝试使用旧项目中的文件覆盖新项目中的此文件,以便传输您的设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM