I decided to try it with eclipse, spring-boot, gradle, and multi-project with project folders arranged in the same hierarchy. It didn't work so I used it as a memo!
I tried to make foo a root project and bar a child project like ↓.
foo ← project folder
build.gradle
settings.gradle
bar ← project folder
build.gradle
foo For gradle in the foo folder, I created gradle as usual and added ʻinclude Flat'bar'` to the first line of settings.gradle.
foo/build.gradle
plugins {
id 'org.springframework.boot' version '2.1.4.RELEASE'
id 'java'
}
apply plugin: 'io.spring.dependency-management'
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
compile project(':bar')
compileOnly 'org.projectlombok:lombok'
}
foo/settings.gradle
includeFlat 'bar'
/*
pluginManagement {
repositories {
gradlePluginPortal()
}
}
*/
rootProject.name = 'foo'
bar
I tried various things and finally got the following.
It didn't recognize well that plugins had ʻid'org.springframework.boot' version '2.1.4.RELEASE'. ʻApply plugin:'io.spring.dependency-management'
and ʻapply plugin:'org.springframework.boot'` may work without it. (I haven't tried it)
bar/build.gradle
plugins {
id 'java'
}
apply plugin: 'io.spring.dependency-management'
apply plugin: 'org.springframework.boot'
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
dependencies {
compileOnly 'org.springframework.boot:spring-boot-starter-thymeleaf'
compileOnly 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-security'
compileOnly 'org.projectlombok:lombok'
}
Anyway, I confirmed that it works with such a configuration. When I touched gradle for the first time in a long time, the description method changed and I felt a slight gap.
Recommended Posts