Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2e-users] Problems with M2Eclipse profiles activation

Hi everyone.

I have a multi module project on Eclipse which consists of 8 projects (being the parent and 7 modules). I am using M2Eclipse with WTP integration, so I start JBoss server directly from Eclipse.

While I was not using profiles, this integration was working fine because I believe M2Eclipse runs something like 'mvn package' and moves the resulting package to my server deploy directory, but now I started using profiles to customize the build for different environments and i´m having some problems, which I explain in the following:

In the different modules I have some profiles which share the same id. For example, let´s say in each module I have "custom.profile1", "custom.profile2" and "custom.profile3".

If I use command line to build that project, I just need to type "mvn -Pcustom.profile1,custom.profile2,custom.profile3 package" from the parent directory. Running that command, the profiles of all modules are activated and everything works just fine.

But from Eclipse, the profiles are not activated... M2Eclipse almost provided the configuration I needed, but as far as I could see, it´s not helping enough in this case. I noticed if I go to project > properties > Maven there´s a field where I can type the 'Active Maven Profiels'. And there is where my problem is... I thought that configuring only the parent project would be enough (as it works in pure Maven when I run the command line in the parent directory), but when I tried it out, I noticed that doing this did not activate the profiles declared in the children modules and for everything to work (unfortunately, not just fine), Im having to configure all the projects to activate the profiles I want. That´s a problem because if I eventually want to change one profile, I´ll need to reconfigure all the projects... and I would need to do it everytime I wanted to change a profile...

I think that maybe if M2Eclipse had an option to configure the profiles globally (just a field 'Active Maven Profiles' in preferences > Maven) should be enough to solve this problem.

But, as there´s no such an option, do you guys have any idea on how to solve this problem only by configuring Eclipse?

I know I could configure {user.home}/.m2/settings.xml to activate the profiles I want, but I really prefer to have a simple way to configure it using Eclipse only, not because of me, but because of the other members of the team who contribute to the project.

Thanks in advance.

Rafael Vanderlei

Back to the top