Maven integration: support profiles when importing

Guys, firsthand, thanks for picking up and embracing support for m2, it's gonna be really helpful for many ;)

There's one feature I'd like to discuss. We at Mule have complex m2 project (minimum 70 modules). Why minimum? Because some modules would be part of the reactor only if a certain profile activated (e.g. -Pdistributions for various end-user packaging modules, -Ptests for integration tests, etc.). Take a look at the root pom: http://svn.codehaus.org/mule/trunk/mule/pom.xml

However, when importing a maven project into IDEA (b6981), there's no way to specify a profile. Disable deep scan, it's gonna mess up things due to poms in the examples (have to be manually unchecked for import, which is a pain in a huge project like that).

So, I would suggest one more wizard screen before the Finish, one containing a list of available profiles (or just a text field to enter one for now) and properties key/value pairs (that's another way to activate/disable a profile). Having specified those, m2 would be able to resolve extra modules in the reactor.

Does it make sense? Not sure if you employ m2 embedder to resolve those or scan poms manually.

6 comments

Hi,
actually this is a thing I consider as very important. There might be two ways of implementing it:

1. A simple variant would be to provide a textfield, (or list) where names of profiles can be entered.
2. The complex one would be to scan ALL relevant POMs and the settings.xml and profiles.xml for declared profiles and list them in a multilistbox for activation.

So, your suggestions do make sense.

Just my thoughts

Ralf

Message was edited by:
Ralf Quebbemann

0

I definitely second this one.. I have a fairly complex Maven build using
profiles.. It would be damn cool is if I could either pick the profile I
want to use when opening the IJ project or perhaps create multiple projects
based on a maven profile.. or even something like a drop down filter of
maven profiles for a single project that would hide/show modules in my
project based on the maven profile selected.

- Grant

"Andrew Perepelytsya" <no_reply@jetbrains.com> wrote in message
news:23297973.1180137186726.JavaMail.itn@is.intellij.net...

Guys, firsthand, thanks for picking up and embracing support for m2, it's
gonna be really helpful for many ;)

>

There's one feature I'd like to discuss. We at Mule have complex m2
project (minimum 70 modules). Why minimum? Because some modules would be
part of the reactor only if a certain profile activated
(e.g. -Pdistributions for various end-user packaging modules, -Ptests for
integration tests, etc.). Take a look at the root pom:
http://svn.codehaus.org/mule/trunk/mule/pom.xml

>

However, when importing a maven project into IDEA (b6981), there's no way
to specify a profile. Disable deep scan, it's gonna mess up things due to
poms in the examples (have to be manually unchecked for import, which is a
pain in a huge project like that).

>

So, I would suggest one more wizard screen before the Finish, one
containing a list of available profiles (or just a text field to enter one
for now) and properties key/value pairs (that's another way to
activate/disable a profile). Having specified those, m2 would be able to
resolve extra modules in the reactor.

>

Does it make sense? Not sure if you employ m2 embedder to resolve those or
scan poms manually.


0

>> 2. The complex one would be to scan ALL relevant POMs and the settings.xml and profiles.xml for declared profiles and list them in a multilistbox for activation.


This one is dangerous and already gives problems. If a deep scan is used (file system search), it may pick up unrelated poms. That is the case for our example applications, where we do bundle a separate user-level pom designed for building the example by a user in the distro. It has nothing to do with the overall build, and is in fact different (typically simpler).

On the other hand, there's catch 22: suppose you have a profile declared downstream in a child module, but not elsewhere. Also assume that this profile activates some dependend modules. Next, suppose there's another profile activating this whole ecosystem. Building from a top (or scanning the poms) wouldn't find that ecosystem and extra profiles unless the right combination of profiles is activated.

The above, of course, is a quite complex scenario, but gives the idea of problem span. However, if the scan process scans all poms, merges all possible profile definitions and modules, there's a chance to derive this info. Of course, this is much more complex to implement on IDEA's side.

Andrew

0

I just realized IDEA by default activated ALL modules triggered by the profile. Might not be the desired behavior.

0

Hi,
actually this is a thing I consider as very
important. There might be two ways of implementing
it:

1. A simple variant would be to provide a textfield,
(or list) where names of profiles can be entered.
2. The complex one would be to scan ALL relevant POMs
and the settings.xml and profiles.xml for declared
profiles and list them in a multilistbox for
activation.


Why would number 2 be complex? The maven plugin uses Maven itself to parse/load/execute projects so all the profile information is available to present to the user. No need for manual input. Right?

S.

0


Why would number 2 be complex? The maven plugin uses
Maven itself to parse/load/execute projects so all


I hope so. But then, there's a deep scan option...

the profile information is available to present to
the user. No need for manual input. Right?

I've described a scenario in my other reply. Maven exclusively won't cover all cases. Or do you want IDEA to activate all possible profiles?

0

Please sign in to leave a comment.