Hi

I know that discussions about M2Eclipse should be left for M2Eclipse´s own
mailing list, but I´m gonna share all the problems I´m having (which
concerns on both M2Eclipse and Maven) and if you prefer, we can focus on the
problem with Maven itself.

I´m using Eclipse Helios with M2Eclipse plugin. The installed version of
Maven is 2.2.0.

I´m working in a product with 7 modules (so I have 8 projects in Eclipse,
being one for each module and another for the major pom.xml) and one of them
has several profiles (about 30) and I want to build the project activating
about 8 of them. The simplest approach of activating (-Pprofile1,profile2,
etc) works fine if I build the project from the command line. But from
Eclipse I´m having some issues which may be occurring because of both Maven
and M2Eclipse "limitations" (for now, let´s use the word "limitation", but
after discussion, maybe we can change it to "bug" or "misunderstanding").

M2Eclipse allows me to specify the active profiles by editing Maven settings
on the properties of a specific project. I thought that specifying the
profiles only in the major project which contains the major pom.xml, but if
i do that, for some limitation or bug or some other reason, when M2Eclipse
packages the intern modules the profiles I specified in the "major project"
is not activated... so, for that to work fine, I need to repeat the [quit
big] list of profiles in all of the 8 Eclipse projects. Thats smells really
bad, as I need to keep all lists up-to-date.. if I need to change one signle
profile, I need to change in all projects.

Now that you know the problem I had with M2Eclipse, it comes the issue I´m
having with Maven itself, that occurred when I tried a solution to that
problem with M2Eclipse. Maven has lots of ways to activate profiles and so I
tried to combine 2 of them: specifying the profile on the command line and
using property. Basically, what I did was:

1. On the pom.xml of that module with 30 profiles, I configured activation
by properties like "name: activate.profile1 / value: true", "name:
activate.profile2 / value: true" and so on...
2. On the major pom.xml, I created a profile (with the option
"activatedByDefault" set to true) that combines the intern module profiles,
i.e, I created a "major.profile" which sets the properties
"activate.profile1=true", "activate.profile5=true",
"activate.profile10=true", "activate.profile15=true" and so on...

As the profile is activatedByDefault, I would not need to tell M2Eclipse
which profile I want to activate (so I would not have any repeated list of
profiles to configure on all the projects). I was happy with the solution
(as, in theory, it should work) until I tried to build with it... I thought
that running on the command line mvn -Pmajor.profile package would set all
the properties I defined on that profile and on cascade by doing so I would
activate all the profiles defined on the internal module. But it did not
work. It seems that Maven activation by properties doesn´t work the way I
thought.. it seems it works only if you specify the property on the command
line.

So.. that´s the problem I´m having... I dont have enough information to say
that the fact Maven did not activate the profiles on the intern module even
if the properties configured to activate them were properly set on the major
pom.

Do you guys have any ideas on the best way to solve that?

For those who got to read all this monster text, thanks for your patience.

Regards,
Rafael Vanderlei.

Reply via email to