Importing Maven child project

Hello.

I'm rather beginner with Maven and total newbie with IDEA.

I have following project structure:

parent/
  src/main/java/Parent.java  <--- interface
  pom.xml
  child/
    src/main/java/Child.java <--- class implementing Parent
    pom.xml


This is in parent pom (I omitted root element):

    <modelVersion>4.0.0</modelVersion>
    <groupId>mavenParent</groupId>
    <artifactId>mavenParent</artifactId>
    <version>1.0</version>
    <!-- <packaging>pom</packaging> -->


and this is child pom:
    <modelVersion>4.0.0</modelVersion>
    <groupId>mavenChild</groupId>
    <artifactId>mavenChild</artifactId>
    <version>1.0</version>
    <parent>
      <groupId>mavenParent</groupId>
      <artifactId>mavenParent</artifactId>
      <version>1.0</version>
    </parent>


Now If I import child project as IDEA project parent project isn't imported. Also IDEA highlits errors in "parent element" in child pom (and in Child.java about not knowing Parent interface). However if I go to child directory and run "mvn compile" it completes successfully.


Am I doing something wrong? Is this supported?

I think it is. In my new job we have a very large project with big hierarchy and many modules. It's not recommended to import top project into IDEA (I tried today, bad idea...). Most Java developers use IDEA and they somehow set it up.


Thanks for help.

EDIT: when I open child pom.xml IDEA pops up some notifications asking me if I want to import required projects. I click "import..." but nothing happens.

Please sign in to leave a comment.