'How to set spring multi module under the main root module?

My project dir tree is

.
├── HELP.md
├── README.md
├── batch
├── build
├── build.gradle
├── cats.JPEG
├── chat
├── gradle
├── gradlew
├── gradlew.bat
├── logs
├── out
├── settings.gradle
└── src

Batch, and chat is my modules.

MAIN
- chat
- batch
- src
...

So I set like this

In batch -> build.gradle :

plugins {
    id 'java'
}

group 'malangcute.bellytime'
version '0.0.1-SNAPSHOT'

repositories {
    mavenCentral()
}


dependencies {
    implementation(project(':'))


    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'


    implementation 'org.springframework.boot:spring-boot-starter-batch'

    implementation 'org.springframework.boot:spring-boot-starter-quartz'

}

bootJar {
    enabled = false
}

jar {
    enabled = true
}

and main -> setting.gradle

rootProject.name = 'bellytimeCustomer'
include 'batch'
include 'chat'

In batch build.gradle

I wrote implementation(project(':')) to use domain in root and it works but When I build it It has error that cannot find domain like this

  symbol:   class CoolTime
  location: class CoolTimeBatchConfig
/Users/pupu/Desktop/myproject/bellyTime/bellytimeCustomer/batch/src/main/java/malangcute/bellytime/bellytimeCustomer/batch/CoolTimeBatchConfig.java:93: error: cannot find symbol
    public ItemProcessor<CoolTime, CoolTime> coolTimeItemProcessor() {

How can I fix it? or It's not possible to add module in Main root project?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source