maven : please bring back the ability to select a profile when importing

We have projects here that use java level 4 for sources and 5 for test sources.

When importing the projects in IDEA, all modules are set to java level 4, and since latest EAP (9720 I think) IDEA wide compiler options is set to -target 1.4.

This actually means that before being able ot compile my workspace I have to update all modules (many!) back to level 1.5 and correct compiler options, and this everytim I reimport to pick up any pom changes.

There used to be an option allowing to choose a given profile that would be active when importing, and I used that to import with java level set to 5 everywhere, which eases the pain a lot.
I can't find that option anymore, does it still exist ? and otherwise can it be restored ?

Comment actions Permalink

Any clue or ideas for workaround ?
Am I the only one with that kind of need ?

Comment actions Permalink

Hi, Thibaut,

As for the -target compiler option, it was done to support maven-compiler-plugin's 'target' option. It is set based on the lowest level among the projects since IDEA does not support per-module target level setting at the moment. On the paper it should not cause any problem, let me know if it is.

Source level setting is not directly relates to target level and set for every model separately based on maven-compiler-plugin's 'source'.

I've checked the profiles page on import and in the Maven Projects tool window, they are still there; we have a problem with this build, though, modules disappears after import.
Check the latest eap please.

I'm not sure if I understand you correctly, so please describe elaborate on the problem and, if it is possible, attach a sample project.

Anton Makeev

Comment actions Permalink

Thanks for taking the time to reply Anton

Howevever, if I'm correct the profiles tab on Maven toolwindow (this is the one you're talking about right ?) is only used in "maven goal execution" ?
If you're supposed to be able to select a (or several) profiles to be active while importing I don't see how you can do that.

Furthermore it seems not all profiles are displayed

I Just checked on one project and running mvn help:all-profiles returns
[INFO] Listing Profiles for Project:
  Profile Id: R2DS_Dev (Active: true , Source: settings.xml)
  Profile Id: R2DS_Dev (Active: true , Source: settings.xml)
  Profile Id: idea (Active: false , Source: settings.xml)
  Profile Id: R2 (Active: false , Source: settings.xml)
  Profile Id: proximity (Active: false , Source: settings.xml)
  Profile Id: tracing (Active: false , Source: pom)
  Profile Id: deploy (Active: false , Source: pom)
  Profile Id: itest (Active: false , Source: pom)

But when opening this project in IDEA, no profile is displayed in the Maven project tab

My general idea was that I would define a profile specialized for IDEA importing in my .m2/settings.xml file and tell IDEA to activate it when importing (eg analog to running -P idea).

Back to my target/source issue.
we're using 1.5 for unit tests because it allows taking advantage of mock libraries (jmock in our case), and if idea compiles with -target 1.4 then you can't use source level 1.5. And to compile our test cases we need to have source 1.5.

Comment actions Permalink

I meant the 'Profiles' node in the 'Maven Projects' tree and 'Select Profiles' step in the 'Import from an external model' wizard;these profiles affect importing.
Unfortunately, none of them display profiles from 'settings.xml' at the moment and never did. I'll add this feature a bit later in the 9.0 branch.

And the target/source options, I see the problem now, I'll invent some workaround soon and we'll introduce per module target configuration in 9.0.

Anton Makeev

Comment actions Permalink

that's interesting.

I have to say I never "import from external model", rather I "open project" and select the pom.

However for some reason IDEA does not see all profiles. To be honest, and I have no reason why it reports failing on looking up some parents even though dependencies (that are configured in those not-found parents using dependencyManagement sections) seem to be found anyway.

I have added an idea profile to my .m2\settigns.xml, but when trying "import from external model" it doesn't show up in the list of profiles.
It's correctly found by mvn help:all-profiles


Please sign in to leave a comment.