4

I have weird issue, mvn clean install -Dproject.version=1 or jenkins build is going through fine but intellij is all red and angry when i open the modules in IDE, this affects the development.

I see below issue in intellij logs

The POM for << module >> is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details

Code is heavily copyrighted so cant disclose but here is a basic outline

  • fabric-common : base module (common fabric to bind entire project , contains all clients and db modules ) - lets call it FC
  • utilities : module in question ( imports FC ) and uses db modules - lets call utilities U

Now U is all red because it cant find DAO's of db, if Us POM explicitly contains db modules every one is happy.

Auto-Import on intellij is enabled, imports are happening on maven3, and local repository is all updated with correct version too.

Is this a known issue or any help around?

Intellij details

enter image description here

Edit

Question suggested as duplicate is an issue specific to maven not able to resolve dependencies but in my case, maven build from command line or jenkins is fine but IDE fails.

NoobEditor
  • 15,563
  • 19
  • 81
  • 112
  • Possible duplicate of [The POM for is invalid, transitive dependencies (if any) will not be available](https://stackoverflow.com/questions/23581194/the-pom-for-name-is-invalid-transitive-dependencies-if-any-will-not-be-avai) – Kamil Apr 30 '19 at 10:08
  • nope...that thread is about an issue with `maven` itself, in my case, `intellij` is crying, `maven` is cool! – NoobEditor Apr 30 '19 at 10:30
  • Try running maven clean install from inside IntelliJ – chaitan64arun Apr 30 '19 at 10:59
  • @chaitan64arun as in the `terminal` of `intellij`..right? or some other place in IDE? if terminal of intellij, then done already, no help in removing red highlights from IDE!!! – NoobEditor Apr 30 '19 at 11:00
  • No from "Maven build" which is generally on the right side. You get it by installing "Maven Integration" plugin https://www.jetbrains.com/help/img/idea/2019.1/maven_tool_window_structure.png – chaitan64arun Apr 30 '19 at 11:03
  • @chaitan64arun : hmmm...never tried this. how do i pass `project.version` in this? seems to just run `install` command on click which fails due to missing version! – NoobEditor Apr 30 '19 at 11:55

1 Answers1

2

you can try to

  • invalidate cache an restart
  • delete .iml and .ipr files
  • clean up Project structure (if I recall correctly) Libraries or Artifacts. Just delete them, so they get updated via Maven.
  • run mvn idea:idea

in arbitrary order. I cannot recall which one it was, but I'd place my bets on .ipr/.iml, clean up Project structure and Invalidate restart

Edit

here is what worked


ensure intellij is open before we start doing this ( needed to invalidate cache in step 3 ) and you have setup maven3 as home directory ( Preferences -> Build, Execution, Deploymnet -> Maven : Maven Home directory)

delete all iml, ipr, iws

cd <parent dir of project>
find project/ -type f -name "*iml*" -exec rm {} \;
find project/ -type f -name "*ipr*" -exec rm {} \;
find project/ -type f -name "*iws*" -exec rm {} \;

remove local repository

   cd ~/.m2
   mv repository* ~/Desktop/

:: close the intellij project window ( not intellij, just project window )

:: invalidate cache and restart ( this would close intellij and restart with blank screen)

:: once intellij opens, open the project by selecting project level POM ( this would re-import all dependencies in local again - one we deleted in step 4 )

cd < project path >

:: run ( in intellij terminal if possible - being superstitious here ) - this would update local intellij:

mvn -U idea:idea -Dproject.version=1.0

:: right click on pom.xml of specific project, Maven -> Reimport

NoobEditor
  • 15,563
  • 19
  • 81
  • 112
sschrass
  • 7,014
  • 6
  • 43
  • 62