Issues importing maven projects
Intellij (2020.3 Beta, but the same is true for earlier versions) is having a difficult time with importing maven modules. In this very large project (2800 maven modules, using sparse checkout to minimize this) intellij is not able to succesfully import all projects (I did set the correct memory options so it no longer runs out of memory during the import). It seems to import everything but when for instance I want to run a test a start a session of whack-a-mole where I have to reimport individual modules (can not go further out than 1 parent) until Intellij understands all the dependencies again.
I would like to understand the cause of this whack-a-mole so I can mitigate the problem.
There is also another problem that Intellij seems to no longer understand when profiles are used to enable modules (the previous new project -> import from existing sources -> select pom file did allow me to select the profiles back in late 2018?). In my specific case:
<profile>
<id>Constants</id>
<activation>
<file>
<exists>Constants/pom.xml</exists>
</file>
</activation>
<modules>
<module>Constants</module>
</modules>
</profile>
I use this because I am doing sparse checkouts skipping as many modules as I can, which means I would for instance omit the entire /Constants directory if it is not required (example chosen due to it not containing any company specific file names))
Please sign in to leave a comment.
Hello Christian,
Please restart the IDE, re-import your project if possible, and attach the log archive (Help | Collect Logs and Diagnostic Data) generated after reproducing the problem.
My project is not that big and Im having the same issue. is there a way to go back while you fix this issues?
jose robles
Are you referring to certain modules needing re-importing after project import, or profiles not enabling modules? Please describe what you are doing and what goes not as expected.
Do you get different behavior when running Maven from command line with the same Maven version and JDK?
In order to fix the issue, we need to understand what component is causing it. Can you upload your project to https://uploads.jetbrains.com and provide the id so that we can check it?
Hi Arina,
I ran out of time to reproduce the issues, I will do see next week.
Kind regards,
Christian
Hi Arina,
I have uploaded the log ( 2020_12_07_6p6GeKM8wW3xQhaM ). This is what I did:
1) git clean -Xf (removes all current .iml files)
2) rm -rf .idea
3) emptied intellij log
4) from a different intellij window I did File -> new project -> import from existing sources and selected the root pom
5) redacted the file to remove company paths and uploaded it
After that was done intellij started and imported the projects, however (it seems) it only went 1 level deep and missed the rest (I can see this by the limited amount of .iml files created 10 out of 482 pom files and no source folders are created). I have also uploaded the xslt that I use to make maven skip the modules that are not present in the working directory since they are excluded in the sparse checkout (Upload id: 2020_12_07_L2ey3o4nr2ZBM4y2 ). I use this as: find . -name pom.xml -exec sh -c "xmllint.exe --xpath \"boolean(//*[local-name()='modules'])\" {} | grep 'true' &> /dev/null && xsltproc.exe --output {} /c/dev/.update_pom.xslt {}" \; before importing the project.
Kind regards,
Christian
Thank you Christian, I'll look into it.
Hi Christian,
I found an exception in the log and created a new problem report for this on our issue tracker: https://youtrack.jetbrains.com/issue/IDEA-257246 (all logs were attached privately). The developers will look into it.
Feel free to follow the issue to stay updated on the progress of the investigation.
See this article if you are not familiar with YouTrack.
A few more things.
Does it make a difference to enable/disable the following options under Preferences | Build, Execution, Deployment | Build Tools | Maven | Importing:
Would it be possible for you to attach your project configuration files (
.idea
project configuration sub-folder and module's.iml
files) zipped in an archive that represents your project structure and all used pom.xml files? You can attach everything privately to the YouTrack issue I mentioned above (reduce visibility to jetbrains-team).Please also provide the contents of the Help | About dialog.
Hello Arina,
I have tried to disable the 'Create IntelliJ IDEA modules for aggregator projects (with 'pom' packaging)' option ('Create module groups for multi-module Maven projects' was already disabled) and did a reimport from the root of the project. There does not seem to be a big difference other than Intellij asking me to basically remove all modules that have been imported and Intellij having found more modules that it wants to import (via the popup). The latter does seem to import more parents modules but still not the leave modules (the ones with the code :)).
I will ask the security department if I can upload the pom structure and iml files, those would be a bit to much work to redact.
Kind regards,
Christian