如何在Idea中恢复模块的父文件夹
How do I restore parent folder of modules in Idea
我在目录中创建了一个 java Idea 项目,比如 /path/X/Z,所以我的项目选项卡如下所示:
Z
-.idea
project.iml
然后我在项目中添加了一些 Maven 模块,比如 A、B,所以我的项目选项卡如下所示:
Z
---------A
---------A.iml
---------pom.xml
---------B
---------B.iml
---------pom.xml
-.idea
project.iml
有了这个结构,我可以右键单击 Z 并为每个模块获取 Git 操作(整个项目都在一个 Git 根下)。
然后我将 Z、X 的父目录重命名为其他名称,比如 Y,在 idea 之外,然后重新打开 idea picking 目录 /path/Y/Z。
我不得不重新导入所有模块,但现在我的项目窗格如下所示:
A
A.iml
pom.xml
B
B.iml
pom.xml
并且根目录 Z 不存在,这意味着,仅显示模块。我现在必须右键单击每个模块才能执行 Git 操作。
如何在项目窗格中恢复根目录 Z?
Z
+-.idea
+project.iml
+pom.xml
A
+A.iml
+pom.xml
B
+B.iml
+pom.xml
>pom.xml(Z) <-- parent
..
<modules>
<module>../A</module>
<module>../B</module>
</modules>
..
>pom.xml(A) <-- child1
<parent>
<groupId>ma.****</groupId>
<artifactId>Z</artifactId>
<version>**</version>
<relativePath>../Z</relativePath>
</parent>
>pom.xml(B) <-- child2
<parent>
<groupId>ma.****</groupId>
<artifactId>Z</artifactId>
<version>**</version>
<relativePath>../Z</relativePath>
</parent>
我在目录中创建了一个 java Idea 项目,比如 /path/X/Z,所以我的项目选项卡如下所示:
Z
-.idea
project.iml
然后我在项目中添加了一些 Maven 模块,比如 A、B,所以我的项目选项卡如下所示:
Z
---------A
---------A.iml
---------pom.xml
---------B
---------B.iml
---------pom.xml
-.idea
project.iml
有了这个结构,我可以右键单击 Z 并为每个模块获取 Git 操作(整个项目都在一个 Git 根下)。
然后我将 Z、X 的父目录重命名为其他名称,比如 Y,在 idea 之外,然后重新打开 idea picking 目录 /path/Y/Z。
我不得不重新导入所有模块,但现在我的项目窗格如下所示:
A
A.iml
pom.xml
B
B.iml
pom.xml
并且根目录 Z 不存在,这意味着,仅显示模块。我现在必须右键单击每个模块才能执行 Git 操作。
如何在项目窗格中恢复根目录 Z?
Z
+-.idea
+project.iml
+pom.xml
A
+A.iml
+pom.xml
B
+B.iml
+pom.xml
>pom.xml(Z) <-- parent
..
<modules>
<module>../A</module>
<module>../B</module>
</modules>
..
>pom.xml(A) <-- child1
<parent>
<groupId>ma.****</groupId>
<artifactId>Z</artifactId>
<version>**</version>
<relativePath>../Z</relativePath>
</parent>
>pom.xml(B) <-- child2
<parent>
<groupId>ma.****</groupId>
<artifactId>Z</artifactId>
<version>**</version>
<relativePath>../Z</relativePath>
</parent>