0
dependencies {
    compile project('client')
    compile project('-cache
')

Now when I comment out compile project('product-cache-client') it moves to the next one and compains about that.

I tried to add it to gradle.settings in that module like so:

include('client')
include('cache')

But I still get the same error. I even tried adding this to the gradle.settings

project('lib/cache').projectDir = "$rootDir/lib/cache" as File

And still get the same result.

Gradle 4.4

main gradle.build file:

subprojects {

    dependencies {
        compile project('client')
        compile project('cache')

    }

    repositories{
        jcenter()
        mavenCentral()
    }
}

configure(subprojects){
    apply plugin: 'maven'
    apply plugin: 'java'
    apply plugin: 'idea'
    apply plugin: 'eclipse'
}

repositories {

}

buildscript {

    ext {
        sourceCompatibility = 1.8
        targetCompatibility = 1.8
    }
}

dependencies {
    jcenter()
    mavenCentral()
}
Mike3355
  • 11,305
  • 24
  • 96
  • 184

2 Answers2

1

Add the java plugin on top of your parent build, for me this works:

apply plugin:'java'

It is recommended here - the second answer Could not find method compile() for arguments Gradle And also switch the 'dependencies' with 'repositories' - at least in the sample of build.gradle you wrote here they are switched.

bchto
  • 101
  • 1
  • 2
  • But this applies the plugin to subprojects. What if you add it in the top of the parent builg.gradle (your main gradle build). – bchto Jan 25 '18 at 19:31
  • StackOverflow is not a support forum, it's a site for questions and answers about programming. Members are not expected to provide personal support by for example screen sharing. Try to resolve your issue by providing more detail and discussion in the comments and by edits to the question. – Jolta Jan 26 '18 at 08:58
0

when you define dependency as compile then it can not be accessible at the runtime. If you run the project through IDE then it works but when you run with gradle bootRun or mvn spring-boot:run command then above error will throw. So have to just replace compile with implementation.

dependencies {
        implementation project('client')
        implementation project('cache')

    }
Nafaz M N M
  • 1,558
  • 2
  • 27
  • 41