SpringBootとGradleで開発環境を作成する

buildscript {
repositories {
mavenCentral()
}
dependencies {
// Spring Boot Gradle Plugin を使用
classpath ‘org.springframework.boot:spring-boot-gradle-plugin:2.2.0.RELEASE’
// Google App Engine Gradle plugin を使用
classpath ‘com.google.cloud.tools:appengine-gradle-plugin:2.2.0’
}
}

plugins {
id ‘org.springframework.boot’ version ‘2.2.0.RELEASE’
id ‘io.spring.dependency-management’ version ‘1.0.8.RELEASE’
id ‘java’
id ‘war’
}

// App Engine プラグインを導入
apply plugin: ‘com.google.cloud.tools.appengine’

group = ‘info.boukenki’
version = ‘0.0.1-SNAPSHOT’
sourceCompatibility = ‘1.8’

configurations {
developmentOnly
runtimeClasspath {
extendsFrom developmentOnly
}
compileOnly {
extendsFrom annotationProcessor
}
}

// DOMA用の設定
task copyDomaResources(type: Sync) {
from sourceSets.main.resources.srcDirs
into compileJava.destinationDir
include ‘doma.compile.config’
include ‘META-INF//.sql’ include ‘META-INF//.script’
}

compileJava {
// Depend on the above task
dependsOn copyDomaResources
options.encoding = ‘UTF-8’
}

repositories {
mavenCentral()
}

dependencies {
//implementation ‘org.springframework.boot:spring-boot-starter-actuator’
//implementation ‘org.springframework.boot:spring-boot-starter-security’
implementation ‘org.springframework.boot:spring-boot-starter-web’
implementation ‘org.springframework.boot:spring-boot-starter-thymeleaf’
compileOnly ‘org.projectlombok:lombok’
annotationProcessor ‘org.projectlombok:lombok’
developmentOnly ‘org.springframework.boot:spring-boot-devtools’
runtimeOnly ‘mysql:mysql-connector-java’
testImplementation(‘org.springframework.boot:spring-boot-starter-test’) {
exclude group: ‘org.junit.vintage’, module: ‘junit-vintage-engine’
}
testImplementation ‘org.springframework.security:spring-security-test’
// DOMA用の設定
compile “org.seasar.doma:doma:2.6.2”
annotationProcessor “org.seasar.doma:doma:2.6.2”
compile(‘org.seasar.doma.boot:doma-spring-boot-starter:1.1.1’)

// https://mvnrepository.com/artifact/com.google.guava/guava
compile('com.google.guava:guava:28.1-jre')
implementation("com.github.rozidan:modelmapper-spring-boot-starter:1.0.0")
compile group: 'commons-beanutils', name: 'commons-beanutils', version: '1.9.4'
implementation("org.springframework.boot:spring-boot-starter-test") 

// App Engine API の最新版
 implementation 'com.google.appengine:appengine-api-1.0-sdk:+'
 // あ組み込み Tomcat はデプロイの際には使わない
 providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'

}

test {
useJUnitPlatform()
}

//bootRun {
// jvmArgs=[“-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005”]
//}

// Google App Engine タスクの設定
appengine {
// デプロイ時の設定
// GCLOUD_CONFIG を指定しておくと
// gcloud config で設定しているプロジェクト情報がセットされる
deploy {
// デプロイ先の Google Cloud Project ID
projectId = “GCLOUD_CONFIG”
// デプロイによって反映される Web アプリのバージョン
// 指定しなければ新しく生成される
version = “GCLOUD_CONFIG”
stopPreviousVersion = true // default – stop the current version
promote = true // default – & make this the current version
}
}

bootJar {
launchScript()
}