spring-guides / gs-multi-module

Creating a Multi Module Project :: Learn how to build a library and package it for consumption in a Spring Boot application

Home Page:http://spring.io/guides/gs/multi-module

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Test the `complete` directory for 2.0.0.RC1

manueljordan opened this issue · comments

I usually work with Spring Framework and Gradle with the multimodule approach.
So I know how configure Gradle

I have a situation for a Spring Boot multimodule app through Gradle (version 4.5.1).

Note: it working together with STS 3.9.2.

When I work with the following way: springBootVersion = '2.0.0.RC1'

The dependencies between projects fails.

dependencies {
	compile('org.springframework.boot:spring-boot-starter')
	testCompile('org.springframework.boot:spring-boot-starter-test')
	
	compile project(':boot-04-infrastructure')  <---- practically ignored
		
}

If I change to springBootVersion = '1.5.10.RELEASE' all work fine. (Such as your current code)

I have read: Creating a Multi Module Project and that's why I have arrived to this project sample in Github.

I have downloaded the project, executed the complete directory and all works fine.

I want confirm that this problem would be a bug, but when I do the following updates:

  • build.gradle within application
buildscript {
    ext { springBootVersion = '2.0.0.RC1' } //upgrated
    repositories { mavenCentral()
                maven { url "https://repo.spring.io/snapshot" } //<---new
      		maven { url "https://repo.spring.io/milestone" }//<---new
    }
    dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'

jar {
    baseName = 'gs-multi-module-application'
    version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8

repositories { mavenCentral()
                maven { url "https://repo.spring.io/snapshot" }//<---new
  		maven { url "https://repo.spring.io/milestone" }//<---new
}

dependencies {
    compile('org.springframework.boot:spring-boot-starter-actuator')
    compile('org.springframework.boot:spring-boot-starter-web')
    compile project(':library')
    testCompile('org.springframework.boot:spring-boot-starter-test')
}

  • build.gradle within library
buildscript {
    repositories { mavenCentral()
                maven { url "https://repo.spring.io/snapshot" }//<---new
      		maven { url "https://repo.spring.io/milestone" }//<---new
    }
}

plugins { id "io.spring.dependency-management" version "1.0.0.RELEASE" }

ext { springBootVersion = '2.0.0.RC1' } //Upgrated

apply plugin: 'java'
apply plugin: 'eclipse'

jar {
    baseName = 'gs-multi-module-library'
    version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8

repositories { mavenCentral()
                maven { url "https://repo.spring.io/snapshot" }//<---new
  		maven { url "https://repo.spring.io/milestone" }//<---new
}

dependencies {
    compile('org.springframework.boot:spring-boot-starter')
    testCompile('org.springframework.boot:spring-boot-starter-test')
}

dependencyManagement {
    imports { mavenBom("org.springframework.boot:spring-boot-dependencies:${springBootVersion}") }
}

I get the following when I execute gradle build

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':application:compileClasspath'.
> Could not find org.springframework.boot:spring-boot-starter-actuator:.
  Required by:
      project :application
> Could not find org.springframework.boot:spring-boot-starter-web:.
  Required by:
      project :application
> Could not find org.springframework.boot:spring-boot-starter:.
  Required by:
      project :application > project :library

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
3 actionable tasks: 1 executed, 2 up-to-date

During the build, one or more dependencies that were declared without a version failed to resolve:
    org.springframework.boot:spring-boot-starter-actuator:
    org.springframework.boot:spring-boot-starter-web:
    org.springframework.boot:spring-boot-starter:

Did you forget to apply the io.spring.dependency-management plugin to the application project?

Thus I am blocked to confirm if my case is a bug or really is missing some extra configuration. With this confirmation if it is a bug I would report in peace the bug in Spring Boot

Thanks in advance Greg.

-Manuel