35

Me and my friend are working on a Java maven project, the setup is identical as we get the project from git. On my setup Maven imports all dependencies correctly but for my friend it won't find any dependencies.

Things we have tried:

  • Uninstalling and reinstalling Intellij

  • Invalidate caches/Restart

  • Deleting the maven folder in the .Intellij folder and deleting the *.iml and .idea folder and restarted Intellij

  • Right click on project, clicked on maven and clicked reimport.

We both have access to the internet so that shouldn't be the problem either. Also, Maven is set to auto-import in Intellij.

ZeppRock
  • 988
  • 1
  • 10
  • 22
  • 1
    Have a look [here](http://stackoverflow.com/a/18064247/892788) – diyoda_ Apr 21 '17 at 07:06
  • 3
    do right click on the project go to maven do update maven project make sure maven dependencies should be added your buildpath – Narendra Apr 21 '17 at 07:11
  • 6
    First check your maven build on command line which means test the following on plain command line: `mvn clean package` if you have any errors messages etc. – khmarbaise Apr 21 '17 at 07:13
  • We did clean install and got build success, but it's still not working. It says: `could not transfer artifact xxxx from/to internal repository` – ZeppRock Apr 21 '17 at 07:28
  • Is there any error in `pom.xml` in your friend's setup. If yes then please add it to your question. Is the dependency you are having problem with is your private library or available on maven central ? If it is private then have your friend installed in in his local or have you deployed it on any maven repository ? – Pratik Shah Apr 21 '17 at 07:45
  • Okay, we found the problem. The problem was that Intellij did not have the correct path to the settings.xml in the .m2 folder wich was why it didn't get all the dependencies it needed. Thanks for the help everyone! – ZeppRock Apr 21 '17 at 08:31

7 Answers7

77

I think the problem is not IntelliJ, I think maven can not download the dependencies, so you can try to force the dependencies download with the following command:

mvn clean install -U
JUAN CALVOPINA M
  • 3,695
  • 2
  • 21
  • 37
  • 4
    This was driving me crazy! I noticed that IntelliJ was not able to find the bytebuddy dependency and after verifying that I had the correct dependency block, I did this and it worked. Specifically, I used IntelliJ's Maven -> Reimport function. Nice to know that a 3-year old solution still works – Chris Clark Apr 17 '20 at 16:47
  • 1
    Thanks, it worked. For some reason idea/maven wasnt downloading added dependency – Nestor Mar 16 '22 at 14:39
9

Here is what I have done when I was facing the same problem, Right Click Project folder Go to Maven Reload Project, it should download the dependencies.

user17465424
  • 91
  • 1
  • 1
4

if all needed maven jars have been downloaded ,

try update the local repository manually in setting---maven---repositories.

Mobility
  • 3,117
  • 18
  • 31
1

You could do try with the following solutions:

1.Check if your friend is using any proxy, if so add the proxy settings in the settings.xml of maven folder.

<proxies>
        <proxy>
            <id>optional</id>
            <active>true</active>
            <protocol>http</protocol>
            <host>somthing.com</host>
            <port>portnumber</port>
        </proxy>

    </proxies>
  1. update maven and then check with latest version whether you are able to download.
  2. you could manually download jars and then update the repository settings in settings.xml
Kaiizok
  • 90
  • 10
1

For me, I open the maven tab I observe the jar was broken. I did the below steps to resolve the issue.

  1. Remove that not found dependency in the pom
  2. Refresh the maven to remove that broken jar
  3. Add the dependency back to the pom, then refresh the maven to redownload the jars.

it worked for me.

tran tan
  • 51
  • 2
0

Try to remove checkbox off work offline mode enter image description here

urmat abdykerimov
  • 427
  • 1
  • 7
  • 17
Dolche
  • 1
  • 1
0

Check whether you write the dependency inside label <dependencyManagement>