1

I'm trying to add new module to my application. I successfully added movie-api module (you can see in picture below), but when I try to add another module (client-app), I'm getting error as shown in picture. enter image description here

I tried with different solutions including Gradle DSL method not found: 'compile()', but didn't work for me. Appreciate your help!

Build.gradle file:

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')
}
Community
  • 1
  • 1
Yogen Rai
  • 2,961
  • 3
  • 25
  • 37
  • Show your build.gradle file. Sounds like you don't have the java plugin applied or something is breaking the parsing. Can you build via command line? If not what does `build -s` task output? Also check: http://stackoverflow.com/questions/27617687/gradle-dsl-method-not-found-compile?noredirect=1&lq=1 – JBirdVegas Dec 20 '16 at 06:59
  • @JBirdVegas , here is my build.gradle – Yogen Rai Dec 25 '16 at 15:55
  • @JBirdVegas I've added my build.gradle. Would you please look into it? Thank you :) – Yogen Rai Dec 25 '16 at 15:57
  • Please also post the contents of `gradle/wrapper/gradle-wrapper.properties`. From the screen cap looks like your using the wrapper so perhaps the wrapper is using an old version of gradle. Latest is `3.2.1` – JBirdVegas Dec 27 '16 at 20:33

1 Answers1

5

compileOnly was introduced in Gradle 2.12. Make sure you are using a new enough version, with both the command-line and the IDE.

Jamie Bisotti
  • 2,605
  • 19
  • 23
  • 4
    Thank you for answer and sorry for late response from me. I am using Gradle 2.13 and getting that error. – Yogen Rai Dec 25 '16 at 22:32