简体   繁体   中英

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

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>

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.

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

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.

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

If you want this error to be gone without having to worry about all those xml files and copy pasting stuff just try the below solution

Note: This is manual way

In your InteliJ IDEA, go to search and type "Project Structure"

Search>Project Structure

or press:

Ctrl + Alt + Shift + S

Now go to Libraries under project settings

Project Settings>Libraries

Now look for red lined dependencies and click it

For example:

Click "Maven: javax:javaee-web-api:7.0"

Now look whether all three files are red lined

Example: Classes, Sources, JavaDocs

If any of the path under these names are redlined then go to that path and keep the folder open

For example: The path would look like this

Classes

C:\Users\shifny.m2\repository\javax\javaee-web-api\7.0\javaee-web-api-7.0.jar

Sources

C:\Users\shifny.m2\repository\javax\javaee-web-api\7.0\javaee-web-api-7.0-sources.jar

JavaDocs

C:\Users\shifny.m2\repository\javax\javaee-web-api\7.0\javaee-web-api-7.0-javadoc.jar

Now go to the folder as said above and keep it open

In my case its

C:\Users\shifny.m2\repository\javax\javaee-web-api\7.0

Now click this website and search for the jar file

In my case it's:

javaee web api

Now click the link and select the version in next page

In my case it's :

7.0

Now find the "Files" row which will be between "Date" and "Repositories"

In the Files row, click View All

It will open a page like This

In that page download the missing files(classes,source,javadoc)

It will look like this

javaee-web-api-7.0.jar

javaee-web-api-7.0-sources.jar

javaee-web-api-7.0-javadoc.jar

Download all three and put it into the folder which I said you to keep open

Now open your project in inteliJ IDEA and build your project and open the "project structure" as instructed above and check it, the redlined files will have no redlines anymore.

This may seem easy but if there are more files which generates errors then you will have to do this process multiple times and download the missing files. In that case the above solutions may help...

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 ).

This worked for me:

  1. Download 'maven-jar-plugin:2.4.jar' from maven-repository ( https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-jar-plugin/2.4 )

  2. Paste the downloaded 'maven-jar-plugin:2.4.jar' in the local PC's mvn-repository ('C:\Users\[user-name].m2\repository\org\apache\maven\plugins\maven-jar-plugin\2.4' folder)

  3. Wait for IntelliJ to pick up the change

  • All done!

I just solved this problem few minutes ago and this is what I figured and my solution: The reason intellij is popping up with those errors is because the plugin files for those failed plugins in the ".m2" directory are not properly downloaded or they are broken. This is what I did:

  1. I went to "C:\Users\IYANU.m2\repository\org\apache\maven\plugins" folder. You will see that the name of the plugins matches the ones giving errors in IntelliJ
  2. One after the other, in each plugin folder, I checked for the version giving error in IntelliJ then delete the version folder. Like for "maven-jar-plugin", the version in 2.4, delete the 2.4 folder in the maven-jar-plugin folder.
  3. After deleting, go back to IntelliJ and reload your maven project. Make sure there is an internet connection. This will make IntelliJ properly download the plugin and the error won't pop up for that particular plugin again.
  4. Repeat it for the other plugins giving error
  5. Thank me later

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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