Maven dependencies in scope import are not resolved correctly - IntelliJ 13

Hello everyone,
I'm using the trial version of intellij 13 and I have a new problem since upgrading.
In my maven project, I have a project that's importing two other project pom's in scope import, for some intellij does not find them.
The dependency is on their SNAPSHOT version, and it seems that building the projects (And installing them to the local repo) solves this problem.
Any ideas what's the problem? This used to work with intellij 12.
Thanks,
Guy

12 comments
Comment actions Permalink

Hello.

Looks like the issue: http://youtrack.jetbrains.com/issue/IDEA-116406

No updates of the status for now, sorry.

Thank you,
Alexander.

0
Comment actions Permalink

Thank you Alexander, indeed this seems to be it.

Any idea when this might be fixed? We want to buy licenses for 13 (About 20 of them) but people here will not install it since it causes a big problem for us.
Is there a workaround for this?
Thank you,
Guy

0
Comment actions Permalink

I have tried and it seemsI cannot reproduce it, or have not got it right. I will add a comment to the bug tracker.

Thank you,
Alexander.

0
Comment actions Permalink

Attached a sample project that sort of reproduces this.
The project has:

  1. A parent project
  2. A project called "Mod1" with a single dependency.
  3. A project called "Mod2" with a single dependency. It also imports Mod1's pom
  4. A project called "Mod3" that imports Mod2's pom. It has both dependencies from Mod1 and Mod2 (Without a version).


To reproduce the problem, change all the projects' versions (With text replace).
After that, do a maven reimport as IntelliJ suggests, you will see that Mod3's shows a problem. I attached a screenshot.
If you re-import Mod3, it will fix it.



Attachment(s):
error.png
0
Comment actions Permalink

Thank you.

It was Ok for me yesterday, but after restarting IDEA and reopening the project I've really got an error for the root <project> element, like on your picture.

However, the same error is output by Maven on running "validate" task for this pom, and the error (not warning) is exactly that: version for commons-io is missing. Does "validate" completes without error for you?

Regards,
Alexander.

0
Comment actions Permalink

You are right, the poms were not defined correctly.
I changed (almost) everything to be in dependency management, and now the problem is reproducible. Just update the SNAPSHOT version for all poms and re-import.
And I noticed another thing - Even after clean installing everything and re-importing, in Mod3's pom it does not link to the commons-io dependency (Because it's imported from Mod1's dependencyManagement).
Thanks,
Guy



Attachment(s):
PomProblemTests.zip
error.png
0
Comment actions Permalink

Thank you. I probably could say it before: please try Settings / Maven / Importing / Use Maven3 to import project = No. Seems it should return IDEA 12 behavior.

I tried attached project with Maven 3 imporing and for now all errors reported by IDEA correspond to errors reported by Maven's 'validate'. When PomProblemTests (and Mod1 required for Mod2, and Mod2 required for Mod3) is in the local repository, IDEA is green and validation is success. If, say Mod2 is not in the repository, then Mos3 is red in IDEA and validation of Mod3 fails.

With Maven 2 IDEA really shows poms green, while Maven validation (Maven 2 validate!) still reports error. So, IDEA 13 error reporting looks actually closer to "reality".

If you like, you can add comments to the tracker issue to make developer understand the case better.

Regards,
Alexander.

0
Comment actions Permalink

Hi Alex,
This is incorrect. In the latest project I attached after you update the version in all poms, and re-import then intellij will show the attached error message, but maven validate will not show any errors.
As far as I remember Intellij 12 also had the "Use Maven3 to import project" option and it was checked and it worked fine.

0
Comment actions Permalink

Sorry, after update the version - of what element? In the archive all poms have version = 1.7-SNAPSHOT.

Alexander.

0
Comment actions Permalink

Change all versions in all poms to 1.8-SNAPSHOT (For example).
Use CTRL+SHIFT+R - Find and replace.
When it prompts to Skip/Change this file/Change all files select All Files.
When it prompt to do a maven import then re-import.
Then you'll see the project node turning red for Mod2 and Mod3 just like in the previously attached error snapshot

0
Comment actions Permalink

Yes, that's true. But we have one more condition: were the referred artifact (parent and Mod1) with new, updated version installed into local repository before the import or not.

If they were installed then for me Maven validate is success, IDEA import is green. If they were not then for me Maven validate fails, IDEA import is red.

(I understand that my interrogation is too long, so in any case I have already added the reference to this thread to http://youtrack.jetbrains.com/issue/IDEA-116406 . So, in any case the developer will see this talk and may get proper information. If you like you can comment there too.)

Regards,
Alexander.

0
Comment actions Permalink

But we have one more condition: were the referred artifact (parent and Mod1) with new, updated version installed into local repository before the import or not

This contradicts what you said earlier that if "mvn validate" works then so should IDEA. So to make it clear - If you change all versions in all the poms, "mvn validate" will work, but IDEAwill still fail to recognize the modules.

If they were installed then for me Maven validate is success, IDEA import is green.

That's is partly correct - If they are installed then IDEA recognizes everything fine (I wrote this in one of the earlier posts), but is this really the correct behavior? I have to rebuild the project after each version update?

If they were not then for me Maven validate fails

This is not true...

In any case, I'm glad for the interrogation, I think it helped us get to the root of the problem.
Thanks.

0

Please sign in to leave a comment.