I've a springboot project which is organized as multiple modules. I'm using Eclipse 2019-06 (version 4.12) with jdk 1.8 update 131 and apache maven 3.3.9 version.
While importing the project using Maven -> Existing maven projects -> select all project and module level poms->click on finish button, it does the import successfully.
I can view the child modules as separate projects that can be individually run by right clicking on them to project workspace. JUnit tests successfully run using right click -> Run As -> JUnit test.
But if i include a name template while importing the project, the child modules are not recognized even though I select all the child poms also while importing.
Java files show empty J which indicates that it doesn't recognize the Java nature. Because of this, I am unable to run JUnit tests and ctrl+click to navigate to a method or class is also not working.
In both cases, the contents of .project remain the same:
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>my-springboot-app</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
I tried the following steps as suggested in other stackoverflow threads:
Note that eclipse builds the project while importing it when I do not import the project specifying a name template for it but not otherwise.
It would be nice if someone could let me know if that is a problem with m2e plugin itself and that whether I should use another plugin instead.
Eclipse 4.12 comes with m2e pre-installed with it. I thought of using a name template instead of switching workspaces which could take time so that 2-3 flavours of my code can be seen in the same eclipse workspace.
The problem was with custom name being used as name template. When I use any of the available options like [groupid].[artifactid]-version or just the [artifactid]-version, m2e successfully imports the project. I saw some errors in the earlier project with respect to import class resolution but they went away when i closed unrelated projects in workspace.