I wanted to gradle spring boot with multi-project

Introduction

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!

Constitution

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

Contents

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'
}

end

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

I wanted to gradle spring boot with multi-project
Spring Boot 2 multi-project in Gradle
I tried GraphQL with Spring Boot
I tried Flyway with Spring Boot
Spring Boot gradle build with Docker
I tried to get started with Swagger using Spring Boot
I just wanted to logrotate with log4j 2
I tried Lazy Initialization with Spring Boot 2.2.0
(IntelliJ + gradle) Hello World with Spring Boot
Add spring boot and gradle to eclipse
I wanted to make JavaFX programming easier with the Spring Framework
Create a website with Spring Boot + Gradle (jdk1.8.x)
How to use MyBatis2 (iBatis) with Spring Boot 1.4 (Spring 4)
Run Scala applications with Spring Boot through Gradle
How to use built-in h2db with spring boot
I used Docker to solidify the template to be developed with spring boot.
Build Spring Boot project by environment with Gradle
[Java] Article to add validation with Spring Boot 2.3.1.
Try to display hello world with spring + gradle
[Introduction to Spring Boot] Authentication function with Spring Security
I introduced OpenAPI (Swagger) to Spring Boot (gradle) and tried various settings
Download with Spring Boot
I tried to clone a web application full of bugs with Spring Boot
Settings for connecting to MySQL with Spring Boot + Spring JDBC
I tried what I wanted to try with Stream softly.
I tried to implement file upload with Spring MVC
Automatically map DTOs to entities with Spring Boot API
I tried to reduce the capacity of Spring Boot
I tried to get started with Spring Data JPA
How to boot by environment with Spring Boot of Maven
I wanted to develop PHP with vscode remote container
Attempt to SSR Vue.js with Spring Boot and GraalJS
I wrote a test with Spring Boot + JUnit 5 now
Java multi-project creation with Gradle
Try Spring Boot from 0 to 100.
Generate barcode with Spring Boot
Hello World with Spring Boot
Implement GraphQL with Spring Boot
Get started with Spring boot
Hello World with Spring Boot!
Run LIFF with Spring Boot
SNS login with Spring Boot
Introduction to Spring Boot ① ~ DI ~
File upload with Spring Boot
Spring Boot starting with copy
Spring Boot starting with Docker
Hello World with Spring Boot
Set cookies with Spring Boot
Use Spring JDBC with Spring Boot
Add module with Spring Boot
Getting Started with Spring Boot
Introduction to Spring Boot Part 1
Create microservices with Spring Boot
Send email with spring boot
A memo that I was addicted to when making batch processing with Spring Boot
Output embedded Tomcat access log to standard output with Spring Boot
What I fixed when updating to Spring Boot 1.5.12 ・ What I was addicted to
Spring Boot Introductory Guide I tried [Accessing Data with JPA]
I made a plugin to execute jextract with Gradle task
Extract SQL to property file with jdbcTemplate of spring boot
Until INSERT and SELECT to Postgres with Spring boot and thymeleaf