Unresolved plugin: 'org.apache.maven.plugins:m

2020-07-11 07:12发布

问题:

After I use IntelliJ IDEA to create a maven module, there is some problem in the Maven Projects view. And when my cursor hover on the maven project, i see this:

Project:
cn.itcast.babasport:parent:1.0-SNAPSHOT
Location:
/home/shuaidi/IdeaProjects/parent/pom.xml

Problems:
Unresolved plugin: 'org.apache.maven.plugins:maven-jar-plugin:2.4'

Unresolved plugin: 'org.apache.maven.plugins:maven-compiler-plugin:3.1'

Unresolved plugin: 'org.apache.maven.plugins:maven-surefire-plugin:2.12.4'

Unresolved plugin: 'org.apache.maven.plugins:maven-install-plugin:2.4'

Unresolved plugin: 'org.apache.maven.plugins:maven-site-plugin:3.3'

This is my first time using IntelliJ IDEA, so I do these thing with a new installed IDEA and a new installed maven, and i just create a maven module and didn't do any other thing. I don't know why these problem appearance. I just want to create a maven module without any problem.

ps:

this is all my pom file.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>cn.itcast.babasport</groupId>
    <artifactId>parent</artifactId>
    <version>1.0-SNAPSHOT</version>


</project>

回答1:

This is a duplicate of Maven plugins can not be found in IntelliJ. The top answers there did not work for me, so I'll describe what I did.

I just put the needed plugins into my ~/.m2/repository. There are two ways that achieve that. Either download the files manually with mvn dependency:get, or (my preferred way) make the plugins a dependency in some (whichever) pom.xml and build that project.

<dependency>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-install-plugin</artifactId>
    <version>2.4</version>
    <type>maven-plugin</type>
</dependency>

<dependency>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-deploy-plugin</artifactId>
    <version>2.7</version>
    <type>maven-plugin</type>
</dependency>

Now you can remove the dependencies. Then click "Reimport all Maven Projects" in Intellij (the blue circular arrows icon).

This issue seems completely harmless, but the squiggly lines are kind of infuriating, so I am glad I was able to get rid of them.



回答2:

Instead of trying to install the plugin into your repository, actually delete it from your repository. It might have a corrupt or unsupported version that IJ cannot parse.

see https://stackoverflow.com/a/44883900/5093961



回答3:

Check idea.log for errors related to Maven importing, it could be

  • a network issue with localhost
  • invalid VM options for Maven VM (too large heap or a typo in VM options)
  • Maven process failing for some other reason (like the recent Nvidia driver update has caused Java crashes).


回答4:

Change Maven home directory in Maven setting, and select supported Maven bundle version (Maven 2 or Maven 3), then apply setting. It's worked for me.



回答5:

In my case same situation occurred because of different version exist in same system.

System have version 2.** and my project expect 3.** something

in such case, i use maven wrapper instead of maven to build project.

mvn clean install

instead of,

mvnw clean install