简体   繁体   中英

Maven dependency not found

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.

我认为问题不是IntelliJ,我认为maven无法下载依赖项,因此您可以尝试使用以下命令强制下载依赖项:

mvn clean install -U

if all needed maven jars have been downloaded ,

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

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

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.

这是我遇到同样问题时所做的,右键单击项目文件夹转到Maven Reload Project,它应该下载依赖项。

尝试在离线模式下移除复选框在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM