【发布时间】:2019-02-07 23:04:31
【问题描述】:
我在使用 Spring Boot (2.1) 应用程序作为其他 Spring Boot 应用程序的依赖项时遇到了一些麻烦。
我知道这不是推荐的方法,但为了简单起见,我想走那条路。官方的documentation 只是展示了如何用 maven 做到这一点,而不是如何用 gradle 做到这一点。
项目A:
plugins {
id "org.springframework.boot" version "2.1.1.RELEASE"
}
apply plugin: 'io.spring.dependency-management'
项目 B:
plugins {
id "org.springframework.boot" version "2.1.1.RELEASE"
}
apply plugin: 'io.spring.dependency-management'
dependencies {
compile project(':Project A')
}
然而,这会导致项目 A 的 application.properties(来自资源)在项目 b 被执行时被加载。
任何人有一些提示或可以指导我一个工作简单的例子吗?
更新:
通过添加以下内容,在构建最终的 spring boot jar 时它可以工作。不幸的是,当尝试直接在 Intellij 中执行时,问题仍然存在。
jar {
enabled= true
exclude("**/application.properties")
}
【问题讨论】:
标签: java spring spring-boot gradle