Problem importing multiple maven project modules in Eclipse (STS 2.5.2)

I just spent the last hour looking at threads on Stackoverflow.com trying to import a Maven project into Spring ToolSuite 2.5.2.

The Maven project has several modules when I use the import wizard ... in STS to import the project. All modules are listed in Package Explorer, and some of the module dependencies are not resolved.

Is it possible to report the correct way to import a Multi-Module Maven project in STS / Eclipse so that all modules appear in the parent directory? And therefore, are all module dependencies allowed?

The project is in the hierarchy of the file system. I tried various update parameters, project configuration parameters, but all of this to no avail. I have a built-in version of Maven installed in the IDE.

Thank you for your time.

+3
java eclipse sts-springsourcetoolsuite maven maven-2
Mar 07 '11 at 12:40
source share
2 answers

M2Eclipse does a very good job of resolving dependencies between projects. If this does not work, your project structure may have errors. Make sure that:

  • each child project references the correct version of the parent project
  • each dependency has a version corresponding to the current version of the project in the workspace
  • each child project is registered as <module> in the parent pom (the profile must be active if the module is defined in the profile).

If these versions do not match, links to artifacts will be pulled from the local repository, not the eclipse workspace.




About common root projects: I don't think it's a good idea to have a common project, but the Eclipse concept that comes to mind (and which I use for multi-module projects) is a working set.

In Package Explorer, move Top Level Elements to Working Sets :

Top Level Elements> Working Sets

Now select Configure Working Sets ... from the same menu.

Here's a working set with maven3 luggage and all the submodules as separate projects:

multi module working set

+9
Mar 07 2018-11-11T00:
source share

An ugly trick - but sometimes it can help:

  • mvn clean eclipse:clean eclipse:eclipse
  • Import projects as usual Eclipse project
  • enable Maven Dependency Management
  • Perform a project configuration update for all modules.
+4
Mar 09 '11 at 10:20
source share



All Articles