3

I'm working with Java and grade to build the project. The following is the structure:

Root-Project: /modules /rest-api /library-api

My root build.gradle:

allprojects {

    apply plugin: 'base'
}

My root gradle.settings:

rootProject.name = 'RootProject'

include "rest-api"
include "library-api"

project(':rest-api').projectDir = new File('modules/rest-api')
project(':library-api').projectDir = new File('modules/library-api')

My rest project build.gradle:

buildscript {
    ext {
        springBootVersion="2.0.4.RELEASE"
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

group = 'example.com'
mainClassName = 'RestApi'
version = '0.9.0-SNAPSHOT'
sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
    compile project(':library-api')
    .
    .
    .
}

My rest project grade.settings:

include "library-api"

project(':library-api').projectDir = new File('../library-api')

My library build.gradle:

buildscript {
    ext {
        springBootVersion="2.0.4.RELEASE"
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

group = 'example.com'
mainClassName = 'AppRunner'
version = '1.0.0-SNAPSHOT'
sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
    .
    .
    .
}

For some reason, one of the packets inside 'library-api' is not being included into the rest-api classpath, and the, I'm having this error:

error: package library.crud does not exist

and all other classes inside it are not found too. The other classes are fine. Is it any kind cache problem ?? This package was the last think I included on the library.

Thanks all, /Yore

Yore
  • 384
  • 1
  • 4
  • 18
  • 8
    Problem solved using the first answer at this post https://stackoverflow.com/questions/47598848/spring-boot-multi-module-project-with-gradle-doesnt-build – Yore Aug 06 '18 at 01:08

0 Answers0