Search code examples
eclipsemavenm2ests-springsourcetoolsuite

Importing multimodule maven project from Git into Eclipse/STS


I have been desperately trying to import a multimodule maven project from GIT into my (freshly installed) STS 3.9.4. During the last hours I tried lots of solutions that were posted on stack overflow, but none of them worked for me.

These are the steps I did:

  • git cloned the repo from the command line (intentionally, because it didn't work either when I used the GIT integration of STS)
  • imported the project via File / Import / Maven / Existing Maven Projects

After the project was imported, it looks like this: Project structure

(please ignore the red icon at the top left, the problems persists even when this icon is not there)

I can Run As / Maven Install any pom.xml, but when I try to edit java sourcecode Eclipse tells me The resource is not on the build path of a Java project. To fix this I tried:

  • convert to faceted form
  • added Java nature
  • Configure Build Path / Set as source folder
  • add buildcommand org.eclipse.jdt.core.javabuilder to .project

Being able to build is fine, but editing sourcecode without support for Organize Imports, Format Source, and so on is a real pain.


Solution

  • The solution to this problem was somehow hidden, but in the end I have to say the reason was clear. After I checked with a different multimodule project (https://github.com/Activiti/Activiti.git), I was sure that my STS and other components don't suffer from a generic problem. So the cause must be located in the project itself.

    The multimodule project was setup correctly on the pom.xml level. But the topmost pom.xml was modified: most of the modules had been commented out: commented out modules in pom

    The developer who introduced that change didn't experience any problems because he kept his already existing workspace. And the problem only occurs when a new workspace gets created and maven scans the pom files.