Root Project Main project
settings.gradle
rootProject.name = "auto-test"
include 'lz-core'
include 'lz-web'
Copy the code
build.gradle
// Build the configuration
buildscript {
ext {
java_version = '11'
kotlin_version = '1.5.10'
spring_boot_version = '2.5.1'
spring_gradle_plugin_version = '1.0.11. RELEASE'
}
repositories {
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://plugins.gradle.org/m2/' }
mavenCentral()
}
dependencies {
// https://plugins.gradle.org/search?term=org.jetbrains.kotlin%3Akotlin-gradle-plugin
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// https://kotlinlang.org/docs/all-open-plugin.html#spring-support
classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlin_version"
/ / an offer similar Gradle https://plugins.gradle.org/plugin/io.spring.dependency-management plugin Maven dependency management functions
classpath "io.spring.gradle:dependency-management-plugin:$spring_gradle_plugin_version"
// https://plugins.gradle.org/plugin/org.springframework.boot
classpath "org.springframework.boot:spring-boot-gradle-plugin:$spring_boot_version"}}// all Project configuration
allprojects {
group = 'com.lz.auto-test'
version = '0.0.1 - the SNAPSHOT'
repositories {
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://plugins.gradle.org/m2/' }
mavenCentral()
}
}
// Subproject configuration
subprojects {
apply plugin: 'kotlin'
apply plugin: "kotlin-spring"
apply plugin: "io.spring.dependency-management"
apply plugin: "org.springframework.boot"
sourceCompatibility = java_version
targetCompatibility = java_version
compileKotlin {
kotlinOptions {
suppressWarnings = true // No warnings are generated
verbose = true // Enable verbose log output
freeCompilerArgs = ["-Xjsr305=strict"] // Append a list of compiler arguments
jvmTarget = java_version // Target version of the generated JVM bytecode
javaParameters = true // Generate Java 1.8 reflected metadata for method parameters
}
}
dependencies {
}
dependencyManagement {
imports {
mavenBom "org.springframework.boot:spring-boot-dependencies:$spring_boot_version"}}}Copy the code
Sub Projects
Non-executable JARS
// bootJar: the package is an executable JAR, the module only depends on the file, do not need it, can be disabled, otherwise it will not get an error during build
bootJar {
enabled = false
}
dependencies {
compileOnly 'org.projectlombok:lombok'
}
Copy the code
An executable jar
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin'
implementation 'org.jetbrains.kotlin:kotlin-reflect'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.h2database:h2'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'com. Lz. Auto - test: lz - core: 0.0.1 - the SNAPSHOT'
}
Copy the code