微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

我在 pom.xml 中的 artifactID 没有在 Intellij 中注册

如何解决我在 pom.xml 中的 artifactID 没有在 Intellij 中注册

出于某种原因,我的 pom.xml 的工件是红色的。我尝试刷新 maven,直接从文件中使用另一个 maven 依赖项。

我尝试使用内置 maven 和 maven 包装器,但由于某种原因,仍然无法读取 Artifact ID。

This is what pom.xml looks like

<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

解决方法

与 Eclipse 不同,IntelliJ 在保存文件时不会加载 Maven 更改。

你必须按CTRL+Shift+O

来触发它

此外,您可以在更改任何内容时点击 pom.xml 编辑器中弹出的小按钮:

enter image description here

这将加载 Maven 更改并下载新添加的依赖项以及删除已删除的依赖项。

,

确保这些依赖项确实存在于您的本地 Maven 存储库中,并在设置(macOS 上的首选项)中更新存储库 |构建、执行、部署 |构建工具 |马文 | 存储库 设置。 enter image description here

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。