-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
78 lines (68 loc) · 2.29 KB
/
Copy pathbuild.gradle
File metadata and controls
78 lines (68 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Apply the java-library plugin to add support for Java Library
buildscript {
repositories {
mavenCentral()
jcenter()
gradlePluginPortal()
}
dependencies {
classpath 'com.bmuschko:gradle-tomcat-plugin:2.7.0'
classpath "mysql:mysql-connector-java:8.0.15" // mysql8系
}
}
plugins {
id 'java-library'
id 'java'
id 'eclipse'
id 'war'
id "com.avast.gradle.docker-compose" version "0.13.4"
id 'com.palantir.docker' version '0.25.0'
}
apply plugin: 'com.bmuschko.tomcat'
// versionの指定
ext {
tomcatVersion = '9.0.10'
mySQLVersion = '8.0.15'
}
sourceSets {
sourceCompatibility = 1.8
targetCompatibility = 1.8
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
}
// In this section you declare where to find the dependencies of your project
repositories {
mavenCentral()
}
dependencies {
//tomcat & サーブレットの設定
providedCompile group: 'javax.servlet', name: 'javax.servlet-api', version: '4.0.1'
providedCompile group: 'javax.servlet.jsp', name: 'javax.servlet.jsp-api', version: '2.3.1'
// tomcat
tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
"org.apache.tomcat.embed:tomcat-embed-logging-juli:9.0.0.M6",
"org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}"
// MySQL
implementation "mysql:mysql-connector-java:$mySQLVersion"
implementation('com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.8.5')
implementation('com.fasterxml.jackson.core:jackson-core:2.8.5')
implementation('com.fasterxml.jackson.core:jackson-databind:2.8.5')
}
tomcat() {
stopPort = 8888
httpProtocol = 'org.apache.coyote.http11.Http11Nio2Protocol'
ajpProtocol = 'org.apache.coyote.ajp.AjpNio2Protocol'
// プロジェクト名(コンテキストパス)
// http://localhost:8080/springwork2000g0 の場合
if( project.hasProperty('environment') ){
contextPath = "${project.environment}"
} else {
contextPath = 'springwork2000g0'
}
}
// 参考:https://github.com/avast/gradle-docker-compose-plugin
dockerCompose {
if(project.hasProperty('environment')){
useComposeFiles = ["docker/${project.environment}/docker-compose.yml"]
upAdditionalArgs = ['--remove-orphans']
}
}