Spring启动和Gradle多模块项目无法正确加载依赖项

bre*_*Dev 1 java gradle spring-boot spring-boot-gradle-plugin

基本上我有一个使用Gradle构建的spring boot项目.该项目有一个根项目,包含另外4个子模块.根项目settings.gradle如下所示:

rootProject.name = 'proj'

include 'proj-app'
include 'proj-integration-tests'
include 'proj-model'
include 'proj-service'
Run Code Online (Sandbox Code Playgroud)

app模块包含spring-boot-gradle-plugin并公开了一些api.

我想要做的是创建仅包含集成测试的proj-integration-tests子模块.问题从这里开始,因为我需要proj-app依赖.

所以在proj-integration-tests中我有build.gradle包含:

dependencies {
  testCompile('org.springframework.boot:spring-boot-starter-web')
  testCompile('org.springframework.boot:spring-boot-starter-test')
  testCompile project(':proj-app')
  testCompile project(':proj-model')
}
Run Code Online (Sandbox Code Playgroud)

自集成测试以来,我需要proj-app依赖:

@RunWith(SpringRunner.class)
@SpringBootTest(classes = ProjApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
Run Code Online (Sandbox Code Playgroud)

需要启动Spring启动应用程序(ProjApplication.class),它位于proj-app模块中.

我从Gradle得到的错误是:"找不到符号ProjApplication".

为什么Gradle无法正确管理proj-app依赖?提前致谢 ;)

bre*_*Dev 9

似乎proj-app依赖是以spring boot方式构建的.这意味着获得的工件是一个可执行的spring boot far jar.这就是为什么在编译时proj-integration-tests无法从proj-app中找到类.
因此,为了维护可执行jar,并将proj-app作为proj-integration-tests模块中的依赖项,我已经从proj app修改了build.gradle以创建两个jar:以spring boot方式和标准版本:

bootJar {
baseName = 'proj-app-boot'
enabled = true
}

jar {
baseName = 'proj-app'
enabled = true
}
Run Code Online (Sandbox Code Playgroud)