0
我试图将新模块添加到我的应用程序中。我成功添加了movie-api模块(您可以在下面的图片中看到),但是当我尝试添加另一个模块(客户端应用程序)时,出现如图所示的错误。 未找到Gradle DSL方法:'compileOnly()'
我试过不同的解决方案,包括Gradle DSL method not found: 'compile()',但没有为我工作。 感谢您的帮助!
的build.gradle文件:
buildscript {
ext {
springBootVersion = '1.4.3.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
jar {
baseName = 'client-app'
version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter')
compileOnly('org.projectlombok:lombok')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
显示你的build.gradle文件。听起来就像你没有应用java插件,或者有什么打破了解析。你可以通过命令行来建立吗?如果不是'build -s'任务输出是什么?另外检查:http://stackoverflow.com/questions/27617687/gradle-dsl-method-not-found-compile?noredirect=1&lq=1 – JBirdVegas
@JBirdVegas,这是我的build.gradle –
@JBirdVegas我已经添加了我的的build.gradle。你能看看它吗?谢谢:) –