Maven multi module project: source file resolution did not work

Answered

Hi,

i moved from Eclipse to IDEA 2019.1.2 Ultimate. After importing my Maven multi module project, following problems occured:

  1. Jumping to Java source in other module under the same parent via ctrl+click always opens the compiled class from .m2/repository instead of the source file
  2. I always have to compile the code manually with maven clean install - otherwise old versions from maven repository are deployed to tomcat
  3. hot code swap did not work
  4. many warnings and errors on unused classes, methods and missing Spring beans are shown

I'm using Maven 3.6, OpenJDK 11, Tomcat 9 and Spring Boot. The project contains one parent with around 40 sub modules, half of them Spring Boot modules assembled as WAR, with excluded tomcat dependency.

I have reimported the project multiple times using different settings with no success.

Any ideas?

 

0
3 comments
Avatar
Yaroslav Bedrov

Hello,

> Jumping to Java source in other module under the same parent via ctrl+click always opens the compiled class from .m2/repository instead of the source file

We have related issue on YouTrack:https://youtrack.jetbrains.com/issue/IDEA-174839

> I always have to compile the code manually with maven clean install - otherwise old versions from maven repository are deployed to tomcat

Same here: https://youtrack.jetbrains.com/issue/IDEA-106162

Is it possible to reproduce the issue with any sample project and provide it for investigation?

 

 

0
Avatar
Permanently deleted user

I tracked the problem down to jgitver. If i exclude the jgitver extension, the workspace resolution works. Maybe the project version i used was a bit unusual: '0-managed-by-jgitver'. I set it to just "1.0.0" and it works better - now Intellij finds sources of sub modules.

0

>I set it to just "1.0.0" and it works better - now Intellij finds sources of sub modules.

For IDE to resolve dependency to a Maven module in project rather than to a jar library form a local Maven repository you need to have:

  • those Maven modules with sources which you have on your local machine must be added to the same IDE project
  • the Maven coordinates (groupId, artifactId, versionId) of these dependencies must match to coordinates of maven modules with sources
0

Please sign in to leave a comment.