[Spingboot]Gradleマルチモジュールプロジェクトの作成
2231 ワード
モジュールとは
モジュールとは、機能的に類似した部分と関連する部分の集合を指す.
ほとんどのプログラムは小さい頃から簡単に始まり、大きく複雑になります.
したがって、プログラムがますます大きくなり、複雑になると、類似したモジュールに分割してソースコードの管理を簡素化できます.
プロジェクトの作成
まず、Spring Initializerでプロジェクトを作成します.

モジュールの追加
IntelliJに従って、現在のプロジェクトの場所でNew Moduleをクリックします.

次の画面で作成するモジュールを作成します.


以下に示すように、複数のモジュールを作成します.

settings.gradleファイルが次のように変更されていることを確認します.
include 'module-common'
include 'module-article'
include 'module-comment'
以下に示すように、追加されたモジュールを含める必要があります.
既存のコンストラクション.こうばい
buildscript {
ext {
springBootVersion = '2.4.9-SNAPSHOT'
}
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/milestone' }
maven { url 'https://repo.spring.io/snapshot' }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath "io.spring.gradle:dependency-management-plugin: 1.0.11.RELEASE"
}
}
subprojects {
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
group = 'com.multi-module'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/milestone' }
maven { url 'https://repo.spring.io/snapshot' }
}
dependencies {...}
test {
useJUnitPlatform()
}
}
project(':module-article') {
dependencies {
compile project(':module-common')
}
}
project(':module-comment') {
dependencies {
compile project(':module-common')
}
}
置換:Reference
この問題について([Spingboot]Gradleマルチモジュールプロジェクトの作成), 我々は、より多くの情報をここで見つけました https://velog.io/@ybw903/Spring-boot-Gradle-멀티-모듈-프로젝트-만들기テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol