. Advertisement .
..3..
. Advertisement .
..4..
I get an error:
Could not find method compile() for arguments [[io.ibj:MattLib:1.1-SNAPSHOT], build_1b5iofu9r9krp7o8mme0dqo9l$_run_closure2_closure8@66fb45e5] on root project 'project'
when I try to run the following code:
dependencies {
compile group: 'org.bukkit', name: 'bukkit', version: '1.7.9-R0.1-SNAPSHOT'
compile('io.ibj:MattLib:1.1-SNAPSHOT') {
exclude group: 'de.bananaco'
exclude 'net.milkbowl:vault:1.2.27'
}
compile group: 'net.citizensnpcs', name: 'citizens', version: '2.0.12'
compile group: 'com.sk89q', name: 'worldedit', version: '5.6.1'
compile group: 'com.sk89q', name: 'worldguard', version: '5.9'
compile group: 'net.milkbowl', name: 'vault', version: '1.2.12'
compile fileTree(dir: 'libs', includes: ['*.jar'])
}
compile 'io.ibj:MattLib:1.1-SNAPSHOT'
dependencies {
compile("org.gradle.test.excludes:api:1.0") {
exclude module: 'shared'
}
}
Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013
Ivy: 2.2.0
JVM: 1.8.0_05 (Oracle Corporation 25.5-b02)
OS: Windows 7 6.1 amd64
How to fix the could not find method compile() for arguments. Please give me some good ideas.
The cause:
You got this error because there was a conflict in the version of Gradle, so the Gradle could not identify the execution configuration. The compile was the cause of this failure. The configurations of compile, testRuntime, testCompile and runtime which the Java plugin recommended had not been used since Gradle 4.10, and finally were excluded in Gradle 7.0. Therefore, this error happened.
Solution:
Because of the fact that
ModuleDependency.exclude(java.util.Map)
method is being used, it must beexclude the module: 'net.milkbowl:vault:1.2.27'
(supplementmodule:
), as described in document forDependencyHandler
which is linked from here.The
compile
,runtime
andtestCompile
configurations introduced by Java plugin have been removed in Grade 7.0 ( Apr 9 2021).These configurations should be replaced with
implementation
,runtimeOnly
,testImplementation
andtestRuntimeOnly
.