解决Maven项目不识别子模块的问题

xu.wang

发布于 2019.12.06 21:55 阅读 3032 评论 0

新项目创建时,遇到了创建maven子项目时,子项目不能被识别的情况。

如图所示:

子项目的pom.xml 与 父项目pom.xml 配置正确;

父项目pom.xml如下:

 <groupId>Soft</groupId>
    <artifactId>Soft</artifactId>
    <version>1.0-SNAPSHOT</version>
    <modules>
        <module>OrganizationManagement</module>
        <module>UserManagement</module>
        <module>Utils</module>
        <module>CourseManagement</module>
    </modules>
    <packaging>pom</packaging>

子项目pom.xml如下:

 <parent>
    <artifactId>Soft</artifactId>
    <groupId>Soft</groupId>
    <version>1.0-SNAPSHOT</version>
  </parent>

  <artifactId>CourseManagement</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>war</packaging>

 

解决办法如下:在 file->Project Structure ,

点击“Module” 点击 “+”然后点击“Import Module”选中未识别的模块的pom.xml .

然后点击“next”等待完成即可。然后点击finish即可。