Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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>
like image 466
贺帅迪 Avatar asked Aug 15 '16 15:08

贺帅迪


5 Answers

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.

like image 134
user7610 Avatar answered Nov 17 '22 20:11

user7610


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

like image 34
Shifny Avatar answered Nov 17 '22 20:11

Shifny


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.

like image 33
Milad Hatami Avatar answered Nov 17 '22 19:11

Milad Hatami


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

like image 7
Steven Spungin Avatar answered Nov 17 '22 21:11

Steven Spungin


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
like image 2
Dhwanil Patel Avatar answered Nov 17 '22 19:11

Dhwanil Patel