The maven aggregation parent-child project created by eclipse. The parent project cannot create a new java.

recently imported a maven project, and there are 4 sub-maven projects below. It is found that the java file in the child maven project cannot automatically depend on the java class of the parent maven project.
I thought to myself to build a new father-son maven project and compare it.
then creates a new multi-module aggregated maven project using eclipse. Parent project: top, child module:module1. If you find that you can"t create new package and java files in the top project, prompt: is not a java project.

but idea is fine. I don"t know why.

Aug.14,2021

use the eclipse project to create a new parent-son maven project, and the parent project is not a java project (. It's my fault that I checked Create a simple project (skip archtype selection)) when I created the parent project. You need to set it to a java project first. And then rely on it in the sub-project.
specific steps:

  • right-click the parent project and select properties- > Project Facets. Convert whatever, select the check box of java to make sure this project becomes java project.
  • right-click sub-project Build Path- > Configure build path. Switch to projects, and enter the parent project add into OK.
Menu