0

After forking OkHttp and then cloning it, I tried to import the project into IntelliJ using Maven.

However, IntelliJ is not resolving the dependencies properly for me. I see errors all over and I have to add the dependencies between each module and external libraries myself.

There must be a proper way to do this, really appreciate any help I can get here.

Edit: I am putting the screenshots here to explain better

This is one of those dependencies errors I am facing enter image description here

From this you can see that no dependencies is added automatically enter image description here

I imported the project from the root folder pom file

If it helps, this is the project I am trying to import OkHttp. I am expecting a much easier way to get the code down and to start work on them.

boxme
  • 187
  • 1
  • 6
  • 14
  • what kind of error?.. can you give us the error log? – ישו אוהב אותך Jun 22 '16 at 04:14
  • @isnotmenow I edited the question to paint a clearer picture to the problems I am facing – boxme Jun 22 '16 at 05:53
  • Maybe this could help: [Building OkHttp](https://github.com/square/okhttp/wiki/Building) – ישו אוהב אותך Jun 22 '16 at 06:02
  • I had similar problems (but with different project) and found quite a lot threads about how to fix it, e.g. http://stackoverflow.com/questions/11454822/import-maven-dependencies-in-intellij-idea. As far as I remember the most common suggestion was to make sure you are using standalone maven (not bundled one in Idea) and correct Java to import the project. Also I'm not sure what IntelliJ version you are using - I was unable to import with Intellij 2016 Ultimate, what's worked for me was Intellij Community 15.0.1 – SathOkh Jun 22 '16 at 06:03
  • @SathOkh I saw that thread before and have tried the few solutions listed but to no avail. I am currently using Intellij Community. `mvn clean install` and then reimporting doesn't help as well – boxme Jun 22 '16 at 06:23

1 Answers1

2

Sorry for late answer, but maybe it helps someone especially I keep seeing similar problems all the time and had them myself few times. These steps usually works for me and were tested on OkHttp. They are the same like from my comment above but maybe something has been missed:

  1. git clone https://github.com/square/okhttp.git
  2. Download JDK (in my case it's 1.8.0_91 but it shouldn't be so important)
  3. Download Apache Maven (3.3.9 works for me)
  4. Run IntelliJ Idea (tested on 2016.2 Community) and enter "Settings" (Click "Cancel" if a project is loaded automatically) enter image description here
  5. Find "Maven" and choose downloaded and extracted in step 3 enter image description here
  6. Find "jre" and choose the one downloaded in step 2 enter image description here
  7. Accept changes - "Ok" button
  8. Choose "Open" enter image description here
  9. And choose pom.xml from root directory enter image description here
  10. After re-indexing and import everything should work correctly enter image description here
SathOkh
  • 826
  • 2
  • 12
  • 24