For my setup, I have profiles defined in my ~/.m2/settings.xml
, where the profiles define some project-specific repositories. From the command line, I can successfully build the projects using -PprofileHere
. However, the profile isn't enabled automatically (i.e. activeByDefault
is not set to true
for the profile).
In Eclipse 4.5.1 (Mars 1) with m2e 1.6.2.20150902-0002, I import the projects using Import
→ Maven
→ Existing Maven Projects
. I select the parent project and Eclipse imports them. The children projects are imported, but as expected, their dependencies aren't correctly resolved. To attempt to fix this, I select the parent project, right-click Maven
→ Select Maven Profiles...
and select the correct profile for the parent. I then do the m2e tango by trying various combinations of the following:
Project
→ Clean...
)Maven
→ Update Project...
)Eclipse continuously shows the dependencies unresolved on the children projects when viewing the children pom.xml
's or opening a class in a child module with unresolved dependencies. The only workaround I've found is by enabling the profile automatically in my ~/.m2/settings.xml
. Then and only then does Eclipse properly resolve the Maven dependencies.
What am I doing wrong when originally importing / configuring projects in Eclipse?
How it worked for me in a sample project providing the same scenario: make Eclipse use a profile by default for a Maven build.
I never used this option, but apparently its purpose should suit your need.