Maven plugins can not be found in IntelliJ

2020-02-07 17:25发布

After I updated my IntelliJ version from 12 to 13, I see errors on my Maven Profile/Project/Plugins saying the following plugins can not be resolved:

org.apache.maven.plugins:maven-clean-plugin:2.4.1
org.apache.maven.plugins:maven-deploy-plugin
org.apache.maven.plugins:maven-install-plugin
org.apache.maven.plugins:maven-site-plugin

While I was using IntelliJ 12 these were not in my plugins list, somehow they are added after the update and now it complains they can not be found, where can I remove these plugins from the list OR resolve the problem by installing them?

I can run maven goals clean and compile without problem, but the profile/plugins just looks all in red with warnings which I don't like.

26条回答
淡お忘
2楼-- · 2020-02-07 18:11

You can add them as dependencies:

<dependencies>
    <dependency>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-clean-plugin</artifactId>
        <version>2.4.1</version>
    </dependency>
</dependencies>

Intellij will resolve them. After successfull import dependencies, you can clean them.

查看更多
SAY GOODBYE
3楼-- · 2020-02-07 18:12

this might help someone down the line

i faced similar issues, my system was not able to resolve the proxy server
so connected to the local wifi hotpsot.

查看更多
祖国的老花朵
4楼-- · 2020-02-07 18:13

In my case, there were two slightly different dependences (version 2.1 vs 2.0) in two maven sub-modules. After I switched to a single version the error has gone in IDEA 14. (Refresh and .m2 swipe didn't help.)

查看更多
一夜七次
5楼-- · 2020-02-07 18:14

If you have red squiggles underneath the project in the Maven plugin, try clicking the "Reimport All Maven Projects" button (looks like a refresh symbol).

Reimport all Maven Projects

查看更多
我只想做你的唯一
6楼-- · 2020-02-07 18:18

I had this problem for years with the maven-deploy plugin, and the error showed up even though I was not directly including the plugin in my POM. As a work-around I had to force include the plugin with a version into my POMs plugin section just to remove the red-squiggly.

After trying every solution on Stack Overflow, I found the problem: Looking into my .m2/repository/org/apache/maven/plugins/maven-deploy-plugin directory there was a version 'X.Y' along with '2.8.2' et al. So I deleted the entire maven-deploy-plugin directory, and then re-imported my Maven project.

So it seems the issue is an IntelliJ bug in parsing the repository. I would not not remove the entire repository though, just the plugins that report an error.

查看更多
我只想做你的唯一
7楼-- · 2020-02-07 18:18

I have change the Maven home directory from Bundled(Maven 3) to Bundled(Maven 2) in the maven setting. And this works for me. Have a try!

查看更多
登录 后发表回答