Attribute Morimori.
IDEA is Community 2019.3.1 Java version is 11 Spring Boot is 2.2.4.RELEASE Gradle is 5.2.1 MyBatis is 3.5.2 (mybatis-spring-boot-starter:2.1.0)
build.gradle
group 'com.xxx.xxx'
version '0.1-SNAPSHOT'
// Spring Boot ver:2.2.4
buildscript {
def springBootVersion = '2.2.4.RELEASE'
repositories { mavenCentral() }
dependencies {
classpath ("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
//Java plugin
apply plugin:'java'
//Gradle plug-in settings that output various IDE configuration files
apply plugin:'idea'
apply plugin:'eclipse'
//Spring Boot related plugins
apply plugin:'org.springframework.boot'
apply plugin:'io.spring.dependency-management'
//Output war file
apply plugin: 'war'
//Java version
def javaVersion = JavaVersion.VERSION_11
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
//Dependent library source repository
repositories { mavenCentral() }
//Dependent libraries
dependencies {
// SpringBoot
compile("org.postgresql:postgresql")
compile("org.springframework.boot:spring-boot-devtools")
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-jdbc")
testCompile("org.springframework.boot:spring-boot-starter-test")
// JUnit
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.2.0'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.2.0'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.2.0'
// GSON
compile("com.google.code.gson:gson")
// myBatis
compile("org.mybatis.spring.boot:mybatis-spring-boot-starter:2.1.0")
compile("ch.qos.logback:logback-classic")
testCompile("org.mybatis.spring.boot:mybatis-spring-boot-starter-test:2.1.0")
}
test {
//Use JUnit5 when building gradle
useJUnitPlatform()
//Number of parallel execution threads for the test
maxParallelForks = 4
filter{
//I can't show it, so I lie down
}
}
//Release version gradle.Get from properties and set
def applicationVersion = project.properties['release.version']
version = applicationVersion
def springBootApplicationName = 'hogehoge'
bootJar {
archiveBaseName = springBootApplicationName
version = applicationVersion
}
bootWar {
archiveBaseName = springBootApplicationName
version = applicationVersion
}
I hope you find it helpful as it has a lot of attributes.