Plugin with id 'maven' not found

I am getting this error at build stage. I am using ci/cd on gitlab with gradle image.

build-jar:dev:
image: gradle:jdk11
stage: build-jar

$ gradle spotlessApply clean build --stacktrace
Welcome to Gradle 7.0!
Here are the highlights of this release:

  • File system watching enabled by default
  • Support for running with and building Java 16 projects
  • Native support for Apple Silicon processors
  • Dependency catalog feature preview
    For more details see Gradle 7.0 Release Notes
    Starting a Gradle Daemon (subsequent builds will be faster)
    FAILURE: Build failed with an exception.
  • Where:
    Build file ‘/builds/app/build.gradle’ line: 20
  • What went wrong:
    A problem occurred evaluating root project ‘app’.

Plugin with id ‘maven’ not found.

  • Try:
    Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Exception is:
    org.gradle.api.GradleScriptException: A problem occurred evaluating root project ‘app’.
    at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:93)
    at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.lambda$apply$0(DefaultScriptPluginFactory.java:133)
    at org.gradle.configuration.ProjectScriptTarget.addConfiguration(ProjectScriptTarget.java:77)
    at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:136)
    at org.gradle.configuration.BuildOperationScriptPlugin$1.run(BuildOperationScriptPlugin.java:65)
    at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
    at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
    at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
    at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
    at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
    at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
    at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:56)

    Caused by: org.gradle.api.plugins.UnknownPluginException: Plugin with id ‘maven’ not found.
    at org.gradle.api.internal.plugins.DefaultPluginManager.apply(DefaultPluginManager.java:134)
    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyType(DefaultObjectConfigurationAction.java:167)
    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:43)
    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:98)
    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:190)
    at org.gradle.api.internal.project.AbstractPluginAware.apply(AbstractPluginAware.java:49)
    at org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.java:37)
    at org.gradle.api.Script$apply$0.callCurrent(Unknown Source)
    at build_db8h74oft2divbopzxd6u9bd8.run(/builds/app/build.gradle:17)
    at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:91)
    … 138 more

  • Get more help at https://help.gradle.org

My graddle.build file

graddle.build File
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath “com.diffplug.spotless:spotless-plugin-gradle:5.1.0”
}

}

plugins {
id ‘org.springframework.boot’ version ‘2.3.1.RELEASE’
id “io.spring.dependency-management” version “1.0.9.RELEASE”
id ‘java’
id ‘jacoco’
id ‘org.sonarqube’ version ‘2.8’

}
apply plugin: ‘com.diffplug.spotless’
apply plugin: ‘maven’
apply plugin: ‘java’
apply plugin: ‘io.spring.dependency-management’

spotless {
java {
eclipse().configFile ‘format.xml’
target project.fileTree(project.rootDir) {
include ‘/*.java’
exclude '
/build/**’
}
enforceCheck true
}
}
group = ‘com’
version = ‘0.0.1-SNAPSHOT’
sourceCompatibility = ‘11’

configurations {
compileOnly {
extendsFrom annotationProcessor
}
}

dependencies {

implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-data-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation('org.springframework.boot:spring-boot-starter-validation')
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-cache'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.security:spring-security-test'
implementation "org.apache.tomcat.embed:tomcat-embed-core:9.0.36"    
implementation "org.apache.tomcat.embed:tomcat-embed-el:9.0.36"     
implementation "org.apache.tomcat.embed:tomcat-embed-websocket:9.0.36"    
implementation "org.apache.tomcat:tomcat-annotations-api:9.0.36"
implementation 'org.modelmapper:modelmapper:2.3.5'
implementation('javax.xml.bind:jaxb-api:2.3.1')
implementation('org.javassist:javassist:3.23.1-GA')

compile group: 'org.springframework.boot', name: 'spring-boot-starter-mail', version: '2.3.4.RELEASE'
compile group: 'javax.mail', name: 'mail', version: '1.4.7'
compile group: 'jmimemagic', name: 'jmimemagic', version: '0.1.2'
compile group: 'com.github.ulisesbocchio', name: 'jasypt-spring-boot-starter', version: '2.1.0'
compileOnly 'org.projectlombok:lombok'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-actuator'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.0'
compile group: 'commons-fileupload', name: 'commons-fileupload', version: '1.4'
compile group: 'com.amazonaws', name: 'aws-java-sdk', version: '1.11.847'
compile 'io.jsonwebtoken:jjwt-api:0.11.1'
runtime 'io.jsonwebtoken:jjwt-impl:0.11.1'
runtime 'io.jsonwebtoken:jjwt-jackson:0.11.1'
runtimeOnly 'mysql:mysql-connector-java'
annotationProcessor 'org.projectlombok:lombok'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
	exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}

The maven plugin has been removed with Gradle 7. See Upgrading your build from Gradle 6.x to the latest for details and other breaking changes.

Thanks @gesellix issue is resolved after upgrade to Gradle 7