Intellij IDEA - Maven 依赖项问题

sur*_*987 7 intellij-idea maven-3 spring-boot

出现以下错误:

无法在项目应用程序服务上执行目标:无法解析项目 com.test.api:app-service:jar:0.0.1-SNAPSHOT 的依赖项:无法访问中心(https://repo.maven.apache.org/ maven2)处于离线模式,并且之前尚未从其中下载工件 com.sony.spe.rainbow:common:jar:1.0。

示例 pom.xml

<groupId>com.test.api</groupId>
<artifactId>app-service</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<dependencies>
        <dependency>
        <groupId>com.test</groupId>
        <artifactId>common</artifactId>
        <version>1.0</version>
        <scope>compile</scope>
    </dependency>
</dependencies>
Run Code Online (Sandbox Code Playgroud)

小智 19

在 IntelliJ Idea 中有一个选项:

在 Maven 工具窗口中,单击“切换离线模式”按钮。

这会将 --offline 选项附加到 IntelliJ IDEA 运行的所有 Maven 命令中。它还将报告在本地存储库中找不到的任何项目。

或者在 Maven settings.xml 中:

<offline>false</offline>
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述