Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix error not found plugin maven-surefire-plugin >= 2.20 on IntelliJ

I tried to migrate to java 11. But when I change the version of plugin maven-surefire-plugin to 2.22.2 that supports java 11, maven or IntelliJ can not find it:

enter image description here

I tried with other versions >= 2.20, but had same error. I tried to fix it:

  1. Firstly, invalidate caches and restart IntelliJ, then reimport maven. But still error.
  2. I deleted all directories in ~/.m2/repository/org/apache/maven/plugins, and then reimport maven. But maven imported plugin maven-surefire-plugin version 2.19.1 automatically, not imported version 2.22.2 (:

enter image description here

  • Update: I installed maven-surefire-plugin version 2.22.2 successfully by maven command line: mvn install. It downloaded the plugin but IntelliJ still has the error. I tried to invalidate caches and restart IntelliJ, it worked.

Thanks @Andrey for the great suggestion!

like image 392
The Sun Avatar asked Dec 16 '19 10:12

The Sun


People also ask

What is the Maven surefire plugin?

Overview This tutorial demonstrates the surefire plugin, one of the core plugins of the Maven build tool. For an overview of the other core plugins, refer to this article. 2. Plugin Goal We can run the tests of a project using the surefire plugin.

How to use Maven clean in IntelliJ?

If you are working in IntelliJ you can use maven plugin instead. On the right side click maven Tab -> plugins -> clean -> clean:clean Thanks for contributing an answer to Stack Overflow!

Is it possible to build malformed projects in Maven?

For this reason, future Maven versions might no longer support building such malformed projects. org.apache.maven.plugins:maven.compiler. The plugin is a plugin that can be added by “Add Denpendency”.

How to run tests of a project using the surefire plugin?

We can run the tests of a project using the surefire plugin. By default, this plugin generates XML reports in the directory target/surefire-reports. This plugin has only one goal, test. This goal is bound to the test phase of the default build lifecycle, and the command mvn test will execute it. 3. Configuration


1 Answers

I fixed this issue, I do:

  • I installed maven-surefire-plugin version 2.22.2 successfully by maven command line: mvn install. It downloaded the plugin but IntelliJ still has the error.
  • And then I tried to invalidate caches and restart IntelliJ, it worked.

Thanks @Andrey for the great suggestion!

like image 141
The Sun Avatar answered Oct 15 '22 04:10

The Sun