1

I am trying to open this module in Intellij: https://github.com/eugenp/tutorials/tree/master/javaxval

The steps followed by me:

  1. Go to required directory javaxval/ in my local and

mvn clean install.

  1. Open the pom.xml inside javaxval/ and open it as a project.

But Intellij is not syncing with the libraries mentioned in pom.xml as I can see in libraries section in Project Structure settings. Also, because of that, I can see lot of compilation errors.

Any idea what is the issue I am facing and how can I fix it?

hatellla
  • 4,796
  • 8
  • 49
  • 101

1 Answers1

1

This project imports and builds fine in IntelliJ IDEA 2019.2.2 version using the bundled Maven 3.6.1 for importing and JDK 1.8.

If it doesn't import/build for you, perform the diagnostics and check the logs as described in this answer. Make sure the parent pom file is present in the directory tree on your disk.

CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
  • I can see the dependencies in external Libraries section on left side but still my code is showing errors: https://imgur.com/a/7Nlzkj9 – hatellla Sep 21 '19 at 20:11
  • Your screenshot shows JDK dependency, not the other dependencies. There should be [a lot more](https://i.imgur.com/fRB998l.png). – CrazyCoder Sep 21 '19 at 20:16
  • Yeah. They are not coming. I check the logs u suggested above: https://pastebin.com/VYK5JSi9. But not sure if its a regular error or something I am missing. – hatellla Sep 21 '19 at 20:22
  • What [JDK](https://i.imgur.com/Jt7zZDm.png) and [Maven](https://i.imgur.com/kJSGf3s.png) versions are used for importing? Does it help if you reset `~/.m2/settings.xml` to the defaults or delete it? What IntelliJ IDEA version do you use? – CrazyCoder Sep 21 '19 at 20:26
  • I think it might be the issue. Whenever I am re-importing the project, the java version here changes back to 1.5. https://imgur.com/a/qq4bRwT – hatellla Sep 21 '19 at 20:30
  • JDK version is 1.8 and maven is 3.3.9. I don't see this file: ~/.m2/settings.xml. IntelliJ version is 2018.3 – hatellla Sep 21 '19 at 20:32
  • 1
    The error in the log: `Caused by: com.google.inject.OutOfScopeException: Cannot access Key[type=org.apache.maven.execution.MavenSession, annotation=[none]] outside of a scoping block`. [Related bug](https://youtrack.jetbrains.com/issue/IDEA-200272). Solution: update to the latest IntelliJ IDEA version: http://www.jetbrains.com/idea/download/index.html. – CrazyCoder Sep 21 '19 at 20:34
  • Yeah. So, looks like it was the issue with this Intellij version. I updated to 2019 one and it works fine now. Thanks a lot for your help. – hatellla Sep 21 '19 at 20:51