57

Plugin with id 'maven' not found.

I got this error in IDEA that uses with 7.1, that is strange as maven is built-in plugin, and should be distributed with gradle.

subprojects {
    apply plugin: 'java'
    apply plugin: 'java-library'
    apply plugin: 'maven'

When running Gradle 6.3, it seems there is no such error.

Paul Verest
  • 60,022
  • 51
  • 208
  • 332

5 Answers5

83

In Gradle 7.x,

The maven plugin has been removed. You should use the maven-publish plugin instead.

Reference: https://docs.gradle.org/7.0/userguide/upgrading_version_6.html#removal_of_the_legacy_maven_plugin

Gokul Nath KP
  • 15,485
  • 24
  • 88
  • 126
  • 3
    sir, I'm new to react-native it stuck in build.gredle file "repository url: "file://${projectDir}/../android/maven", i dont know why? – Four Apr 14 '22 at 07:26
  • 18
    please provide full example, I'm new to gradle, can't understand in which part of file I need do changes. thank you – CodeBy Apr 15 '22 at 10:09
29

Search for the file build.gradle. It should be in your project directory and change the

apply plugin: 'maven'

to

apply plugin: 'maven-publish'
Luisa Restrepo
  • 433
  • 4
  • 5
  • In addition to this, there may also be some code that needs altering, but that will vary from project to project. – sdexp Nov 15 '22 at 14:29
23

The maven plugin was removed in Gradle 7. The documentation suggests to use maven-publish plugin instead.

Ondra K.
  • 2,767
  • 4
  • 23
  • 39
6

As the docs says that the maven plugin was removed and to use the maven-publish plugin instead

Another approach was to use the gradle wrapper with version less than 7. Since wrapper is customizable. Creating a wrapper could be found here

So for example gradle clean build is equivalent to ./gradlew clean build

Since the version of wrapper is less than 7 every task can be ran with the help of ./gradlew <task> or ./gradlew.bat <task>

This worked for me.

Krithick S
  • 408
  • 3
  • 15
2

I had this same Error when I tried to build a Project. The problem was The Gradle version

my Gradle version was above 7 and it showed id 'maven' not found error.

Android Studio go to File->Project Structure and select:

Android Gradle Plugin Version: 4.2.2 Gradle Version: 6.7.1

This seems to make things work again.

Refer github

Paul Verest
  • 60,022
  • 51
  • 208
  • 332