Multi-Module Maven with Profile in Eclipse Does Not Solve Child Dependence

For my installation, I have profiles defined in mine ~/.m2/settings.xml, where profiles define some project-specific repositories. From the command line, I can successfully create projects using -PprofileHere. However, the profile does not turn on automatically (i.e. is activeByDefaultnot set to truefor the profile).

In Eclipse 4.5.1 (Mars 1) with m2e 1.6.2.20150902-0002, I import projects using ImportMavenExisting Maven Projects. I select the parent project, and Eclipse imports them. Projects for children are imported, but, as expected, their dependencies are incorrectly resolved. To try to fix this, I select the parent project, right-click MavenSelect Maven Profiles...and select the correct profile for the parent. Then I do tango m2e, trying to do the following combinations:

  • Cleaning and restoring a project ( ProjectClean...)
  • Updating the parent project (right click, MavenUpdate Project...)
  • Updating subsidiary projects (less)
  • Restart Eclipse

Eclipse continuously displays dependencies that are not resolved in child projects when viewing children pom.xmlor opening a class in a child module with unresolved dependencies. The only workaround I found was to automatically enable the profile in mine ~/.m2/settings.xml. Then and only then does Eclipse correctly resolve Maven dependencies.

What am I doing wrong when initially importing / setting up projects in Eclipse?

+4
source share
1 answer

How this worked for me in an example project with the same scenario: make Eclipse the default profile for Maven build.

  • Right-click the appropriate project> Properties> Maven
  • , Eclipse

enter image description here

, , -, .

+2

Source: https://habr.com/ru/post/1619638/


All Articles