[JAVA] Beispiel für IntellijIDEA + SpringBoot + Gradle + MyBatis

Attribut Morimori.

IDEE ist Community 2019.3.1 Java-Version ist 11 Spring Boot ist 2.2.4.RELEASE Gradle ist 5.2.1 Mein Batis ist 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-Plug-In
apply plugin:'java'
//Gradle-Plug-In-Einstellungen, die verschiedene IDE-Einstellungsdateien ausgeben
apply plugin:'idea'
apply plugin:'eclipse'
//Spring Boot-bezogenes Plug-In
apply plugin:'org.springframework.boot'
apply plugin:'io.spring.dependency-management'
//Kriegsdatei ausgeben
apply plugin: 'war'

//Java-Version
def javaVersion = JavaVersion.VERSION_11
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'

//Abhängiges Bibliotheksquellen-Repository
repositories { mavenCentral() }
//Abhängige Bibliotheken
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 {
    //Verwenden Sie JUnit 5, wenn Sie Gradle erstellen
    useJUnitPlatform()
    //Anzahl der parallelen Ausführungsthreads für den Test
    maxParallelForks = 4
    filter{
        //Ich kann es nicht zeigen, also lege ich mich hin
    }
}

//Versionsgradle freigeben.Holen Sie sich von Eigenschaften und setzen
def applicationVersion = project.properties['release.version']
version = applicationVersion
def springBootApplicationName = 'hogehoge'
bootJar {
    archiveBaseName  = springBootApplicationName
    version = applicationVersion
}
bootWar {
    archiveBaseName  = springBootApplicationName
    version = applicationVersion
}

Ich hoffe, Sie finden es hilfreich, da es viele Attribute hat.

Recommended Posts

Beispiel für IntellijIDEA + SpringBoot + Gradle + MyBatis
Beispiel für die Verwendung von vue.config.js
Festlegen des Werts von log4jdbc.properties
So ändern Sie den Einstellwert von Springboot Hikari CP