Java 找不到 Maven 依赖项

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/43535995/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 00:58:52  来源:igfitidea点击:

Maven dependency not found

javamavenintellij-idea

提问by ZeppRock

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.

我和我的朋友正在开发一个 Java maven 项目,设置与我们从 git 获取项目相同。在我的设置中,Maven 正确导入了所有依赖项,但对于我的朋友,它找不到任何依赖项。

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.

  • 卸载并重新安装 Intellij

  • 使缓存无效/重新启动

  • 删除.Intellij文件夹中的maven文件夹并删除*.iml和.idea文件夹并重启Intellij

  • 右键单击项目,单击 maven 并单击重新导入。

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

我们都可以访问互联网,所以这也不应该是问题。此外,Maven 在 Intellij 中设置为自动导入。

回答by Mobility

if all needed maven jars have been downloaded ,

如果所有需要的 Maven jar 都已下载,

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

尝试在设置---maven---repositories 中手动更新本地存储库。

回答by Kaiizok

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.

1.检查您的朋友是否使用任何代理,如果是,请在maven文件夹的settings.xml中添加代理设置。

<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
  1. 更新maven,然后检查最新版本是否可以下载。
  2. 您可以手动下载 jars,然后更新 settings.xml 中的存储库设置

回答by JUAN CALVOPINA M

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:

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

mvn clean install -U