【发布时间】:2019-06-26 10:13:43
【问题描述】:
我想将多模块 spring-boot 1.5 项目迁移到 spring-boot 2.1。这是一个 gradle 项目(4.9),但不知何故我没有解决。
使用 spring-boot 1.5.9 应用程序编译良好,依赖于其他模块的模块也可以解析类。
升级到 spring-boot 2.0 或 2.1 后,我无法让一个模块解析另一个模块的类。
在我的项目中,项目 api 依赖于库。同样,这个 build.gradle 对我来说适用于 Spring Boot 1.5.9。我很高兴有任何帮助。
buildscript {
ext { springBootVersion = '1.5.9.RELEASE' }
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath "o.s.b:spring-boot-gradle-plugin:${springBootVersion}"
}
}
allprojects {
apply plugin: 'eclipse'
apply plugin: 'maven'
apply plugin: 'maven-publish'
group = 'n.h.f.calculator'
version = "0.1.0-SNAPSHOT"
}
subprojects {
apply plugin: 'groovy'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
sourceCompatibility = JavaVersion.VERSION_1_8
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
compile 'o.c.groovy:groovy'
testCompile 'o.s.b:spring-boot-starter-test'
}
}
project(':' + rootProject.name + '-library') {
dependencies {
compile 'org.springframework.boot:spring-boot-starter'
}
}
project(':' + rootProject.name + '-api') {
dependencies {
compile project (':' + rootProject.name + '-library')
compile 'o.s.b:spring-boot-starter-web'
}
}
然后我成为模块*-api 的编译器问题,它说模块*-lib 的类无法解析。
例子
C:\Development\Projects\Immosoft\financial-calculator\api\src\main\groovy\net\hemisoft\financial\calculator\api\BasicApi.groovy: 7: unable to resolve class net.hemisoft.financial.calculator.library.utils.BasicCalculator
@ line 7, column 1.
import net.hemisoft.financial.calculator.library.utils.BasicCalculator
【问题讨论】:
-
您在构建或运行时遇到的错误是什么?
-
我有模块的编译器问题,它找不到它正在使用的其他模块的类。用spring-boot 1.5没问题
标签: spring-boot gradle migration multi-module