Slide 1

Slide 1 text

© 2024- atWare Inc. Multi-Project Build の魅力 株式会社アットウェア 横山 史尭

Slide 2

Slide 2 text

© 2024- atWare Inc. こんなことありませんか?

Slide 3

Slide 3 text

© 2024- atWare Inc. package org.example.presentation.controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; ... import org.example.repository.user.UserDataModel; @RestController public class UserController { ... @GetMapping("/users") public List getUsers(UsersSearchParams params) { ... List userDataModels = searchUsersService.invoke(params); List userViews = converter.convert(userDataModels); return userViews; } } \ できました! /

Slide 4

Slide 4 text

© 2024- atWare Inc. package org.example.presentation.controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; ... import org.example.repository.user.UserDataModel; @RestController public class UserController { ... @GetMapping("/users") public List getUsers(UsersSearchParams params) { ... List userDataModels = searchUsersService.invoke(params); List userViews = converter.convert(userDataModels); return userViews; } }

Slide 5

Slide 5 text

© 2024- atWare Inc. そこで、

Slide 6

Slide 6 text

© 2024- atWare Inc. Multi-Project Build in Gradle @see https://docs.gradle.org/current/userguide/intro_multi_project_builds.html

Slide 7

Slide 7 text

© 2024- atWare Inc. Multi-Project Build の魅力 - 依存関係の制御 - sub-project の独立性 - domain, application の再利用性 - パフォーマンス向上

Slide 8

Slide 8 text

© 2024- atWare Inc. Project structure

Slide 9

Slide 9 text

© 2024- atWare Inc. Project structure (all) - buildSrc build conventions - app bootable (AppMain.class) - lib: - presentation - application-service-interface - application-service - application-data-interface - data-adaptor - domain - composite project: - util

Slide 10

Slide 10 text

© 2024- atWare Inc. Project structure (simplified) - presentation *Controller, view - application-service-interface interface *Service application I/O - application-service *ServiceImpl - application-data-interface interface *Repository - data-adaptor *RepositoryImpl

Slide 11

Slide 11 text

© 2024- atWare Inc. dependencies { implementation(project( ":lib:application-service-interface" )) implementation(project( ":lib:domain" )) implementation( "org.springframework.boot:spring-boot-starter-web" ) implementation( "org.springframework.boot:spring-boot-starter-thymeleaf" ) } ./lib/presentation/build.gradle

Slide 12

Slide 12 text

© 2024- atWare Inc. dependencies { implementation(project( ":lib:application-service-interface" )) implementation(project( ":lib:application-data-interface" )) implementation(project( ":lib:domain" )) implementation( "org.springframework.boot:spring-boot-starter" ) } ./lib/application-service/build.gradle

Slide 13

Slide 13 text

© 2024- atWare Inc. dependencies { implementation(project( ":lib:application-data-interface" )) implementation(project( ":lib:domain" )) implementation( "org.springframework.boot:spring-boot-starter-data-jpa" ) } ./lib/data-adaptor/build.gradle

Slide 14

Slide 14 text

© 2024- atWare Inc. package org.example.presentation.controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; ... import org.example.repository.user.UserDataModel; @RestController public class UserController { ... @GetMapping("/users") public List getUsers(UsersSearchParams params) { ... List userDataModels = searchUsersService.invoke(params); List userViews = converter.convert(userDataModels); return userViews; } } import できねえ、、

Slide 15

Slide 15 text

© 2024- atWare Inc. まとめ アーキテクチャをハウスルールだけでなく、 実際に強制力のあるものにすることができます。 暴れまわる若手の手綱を握って快適な開発を! 参考: https://docs.gradle.org/current/userguide/userguide.html