新增的Maven插件在IntelliJ中变成红色

问题描述 投票:0回答:2

添加后,我正在使用guideline作为Maven插件

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>2.5.3</version>
      </plugin>

'maven-release-plugin'和'2.5.3'均为红色,我正在使用本地Maven存储库,如何更新它或需要安装任何东西以便IntelliJ可以找到它?我是Maven的新手,可以有人帮助我,非常感谢。

java maven intellij-idea maven-plugin maven-central
2个回答
0
投票

您必须在Maven pom.xml中添加以下内容。

<build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>2.5.3</version>
      </plugin>
    </plugins>
  </build>

一旦添加,根据网络速度在Intellij Idea中等待2分钟。仍然不起作用,单击Intellij Idea右侧的选项卡“ Maven”,然后单击“刷新”按钮。参见下面的图片。

enter image description here


0
投票

File->Settings->Build, Execution, Deployment->Build Tools->Maven处仔细检查您的IntelliJ maven配置

  1. 未选中脱机工作
  2. 您的本地存储库是正确的

enter image description here

通常在%USERFOLDER%\.m2\repository\处仔细检查您的本地存储库文件夹,如果找不到未下载依赖项的jar文件,则通过子文件夹org\apache\maven\plugins\maven-release-plugin

您可以尝试强制Maven下载缺少的依赖项。导航到您的项目pom.xml文件并运行以下命令:

mvn -U -X dependency:copy-dependencies

-U强制更新,-X生成调试日志。

您可以安装dependency manually下载jar并尝试命令:

    mvn install:install-file -Dfile=<path-to-file -DgroupId=org.apache.maven.plugins -DartifactId=maven-release-plugin -Dversion=2.5.3 
© www.soinside.com 2019 - 2024. All rights reserved.