繁体   English   中英

Maven 在 IntelliJ 中找不到插件 IDE

[英]Maven Plugin not found in IntelliJ IDE

我的项目在 pom.xml 文件中有一个新错误。 我该如何解决?

IntelliJ idea中出现如下错误:

Plugin 'org.springframework.boot:spring-boot-maven-plugin:' not found  

从 Intelli J 的首选项中,导航到“构建、执行、部署 > 构建工具 > Maven”,选中“使用插件注册表”,然后单击“确定”。

然后“文件 > 使缓存无效/重新启动”以重新加载 Intelli J。错误将自动消失 go。

添加以下代码

    <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <version>${parent.version}</version>
    </plugin>

然后单击屏幕截图所示的图标,以加载 pom.xml 文件中的 Maven 更改

在此处输入图像描述

我有同样的问题。 今年夏天 Intellij 突然开始抛出这个错误,但构建通过了。 我只需要指定插件的版本,它就会停止抛出这个错误。

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <version>2.3.4.RELEASE</version>
</plugin>

我在使用 IntelliJ 版本 2020.2.4 时遇到了同样的问题。 解决方案是编辑 pom.xml 文件并指定 Spring-Boot Maven 插件的版本,语法如下:

    <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <version>2.4.0</version>
    </plugin>

如上一个答案中所建议的,此 Intelli-J 版本无法识别版本号后的“RELEASE”关键字。

经过长时间的尝试对我有用的是更新远程 maven 存储库的索引:

设置>构建、执行、部署>构建工具> Maven >存储库

然后 select 远程存储库,然后更新。

这必须有效。

如果您尝试更新您的 IDE。 它将永久解决该问题。 显然,IDE 中存在一些错误,该错误已在2021 年 4 月 30 日构建的版本号:Build #IU-211.7142.45 中得到修复。

当您使用里程碑或快照版本时,会出现此错误。 添加适当的pluginRepository元素后,它将被解决。

你可以在这里阅读更多信息: https://docs.spring.io/spring-boot/docs/current/maven-plugin/reference/htmlsingle/#getting-started

<pluginRepositories>
    <pluginRepository>
        <id>spring-snapshots</id>
        <url>https://repo.spring.io/snapshot</url>
    </pluginRepository>
    <pluginRepository>
        <id>spring-milestones</id>
        <url>https://repo.spring.io/milestone</url>
    </pluginRepository>
</pluginRepositories>

PS:以上答案有效,因为他们明确提到了一个不同的版本,这不是里程碑或快照。 IMO 这不是理想的解决方案。

默认情况下,我配置的快照项目继承自 spring-boot-starter-parent 并设置父级。 我添加了版本号,现在如下:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.5.4</version>
</parent>

正如文档所建议的那样:“您应该只需要在此依赖项上指定Spring引导版本号。如果您导入其他启动器,您可以安全地省略版本号。” /current/maven-plugin/reference/htmlsingle/

添加到遇到此问题的任何人,我在 WSL 上,我的项目位于 wsl 的 linux 部分(即,在 mnt 文件夹之外)。 什么 DID 为我解决了这个问题(在无国界尝试更新远程存储库、使缓存无效、 mvn clean compile和其他类似的事情之后)如下:

要从我的pom.xml文件中剪切一个随机依赖项,请单击Vivek Singh 的答案中显示的图标,然后重新粘贴该依赖项并重新单击该图标。

希望它可以帮助某人。

After so many unsuccessful tries I just clicked on the Event Log on the bottom right of the IDE then found out that my pom file had become a non managed then chose to Add as a maven project and then the maven window reappeared

刚开始打字版本和IDE建议mopversion

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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