-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle_old
159 lines (134 loc) · 5.22 KB
/
build.gradle_old
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
apply plugin: 'war'
apply plugin: 'eclipse-wtp'
apply plugin: 'appengine'
version = '0.1.0-SNAPSHOT'
webAppDirName = 'war'
ext {
springVersion = '3.2.6.RELEASE'
appEngineHome = "$System.env.APPENGINE_HOME"
appEngineSdkVersion = '1.9.28'
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.google.appengine:gradle-appengine-plugin:1.9.27'
}
}
repositories {
mavenCentral()
//maven {url 'https://oss.sonatype.org/content/repositories/google-releases/'}
}
dependencies {
//providedCompile "javax.servlet:servlet-api:2.5"
testCompile "junit:junit:4.+"
//compile "org.springframework:spring-webmvc:$springVersion"
// AppEngine dependencies, copy from APPENGINE_HOME lib folders
compile files(
"$appEngineHome/lib/user/appengine-api-1.0-sdk-${appEngineSdkVersion}.jar",
"$appEngineHome/lib/opt/user/appengine-api-labs/v1/appengine-api-labs.jar",
"$appEngineHome/lib/opt/user/appengine-endpoints/v1/appengine-endpoints.jar",
"$appEngineHome/lib/opt/user/appengine-endpoints/v1/appengine-endpoints-deps.jar",
"$appEngineHome/lib/opt/user/datanucleus/v2/asm-4.0.jar",
"$appEngineHome/lib/opt/user/datanucleus/v2/datanucleus-core-3.1.3.jar",
"$appEngineHome/lib/opt/user/datanucleus/v2/datanucleus-api-jpa-3.1.3.jar",
"$appEngineHome/lib/opt/user/datanucleus/v2/datanucleus-api-jdo-3.1.3.jar",
"$appEngineHome/lib/opt/user/datanucleus/v2/datanucleus-appengine-2.1.2.jar",
"$appEngineHome/lib/opt/user/datanucleus/v2/geronimo-jpa_2.0_spec-1.0.jar",
"$appEngineHome/lib/opt/user/datanucleus/v2/jdo-api-3.0.1.jar",
"$appEngineHome/lib/opt/user/datanucleus/v2/jta-1.1.jar",
"$appEngineHome/lib/opt/user/jsr107/v1/jsr107cache-1.1.jar",
"$appEngineHome/lib/opt/user/jsr107/v1/appengine-jsr107cache-${appEngineSdkVersion}.jar")
// runtime dependencies
//runtime "javax.servlet:jstl:1.1.2"
}
eclipse {
// add build commands and specify the project natures
project {
natures.clear()
natures 'org.eclipse.jdt.core.javanature',
'com.google.appengine.eclipse.core.gaeNature',
'org.eclipse.wst.common.project.facet.core.nature'
buildCommands.clear()
buildCommand 'org.eclipse.wst.common.project.facet.core.builder'
buildCommand 'org.eclipse.jdt.core.javabuilder'
buildCommand 'com.google.gdt.eclipse.core.webAppProjectValidator'
buildCommand 'com.google.appengine.eclipse.core.gaeProjectChangeNotifier'
buildCommand 'com.google.appengine.eclipse.core.projectValidator'
buildCommand 'com.google.appengine.eclipse.core.enhancerbuilder'
}
classpath {
defaultOutputDir = file("${project.projectDir}/war/WEB-INF/classes")
// correct classpaths as needed by GAE eclipse plugin
containers.clear()
containers.add 'com.google.appengine.eclipse.core.GAE_CONTAINER'
containers.add 'org.eclipse.jdt.launching.JRE_CONTAINER'
file {
whenMerged { classpath ->
classpath.entries.removeAll {
entry -> entry.kind == 'lib' ||
(entry.kind == 'con' && entry.path == 'org.eclipse.jst.j2ee.internal.web.container')
}
classpath.entries.findAll {
entry -> entry.hasProperty('exported')
}*.exported = false
}
}
}
jdt {
sourceCompatibility = 1.7
targetCompatibility = 1.7
}
// GAE application needs Java 1.7
wtp {
facet {
facets = []
facet name: 'java', version: '1.7'
}
}
}
// task to clean WEB-INF/lib folder
task cleanWarLibDir(type: Delete) {
delete fileTree(dir: "war/WEB-INF/lib")
}
// task to populate WEB-INF/lib folder from the compile dependencies
task populateWarLib(type: Copy) {
into('war/WEB-INF/lib')
from configurations.compile
}
// populate the WEB-INF/lib
tasks.eclipse.dependsOn('checkenv','populateWarLib')
tasks.populateWarLib.dependsOn('cleanWarLibDir')
// task to check the APPENGINE_HOME environment variable and gae sdk version
task checkenv << {
if (System.env.APPENGINE_HOME == null) {
throw new GradleException('The environment variable APPENGINE_HOME is not set')
}
// check sdk jar exist
def sdkJarName = "$appEngineHome/lib/user/appengine-api-1.0-sdk-${appEngineSdkVersion}.jar"
File sdkJar = new File(sdkJarName)
if (!sdkJar.exists()) {
throw new GradleException("The sdk jar file $sdkJarName does not exist")
}
}
// fix the GAE eclipse prop file
tasks.eclipse.doLast {
// write settings file 'com.google.appengine.eclipse.core.prefs'
ant.propertyfile(file: ".settings/com.google.appengine.eclipse.core.prefs") {
ant.entry(key: "eclipse.preferences.version", value: "1")
ant.entry(key: "gaeDatanucleusVersion", value: "v2")
ant.entry(key: "gaeHrdEnabled", value: "true")
}
// write settings file 'com.google.gdt.eclipse.core.prefs'
ant.propertyfile(file: ".settings/com.google.gdt.eclipse.core.prefs") {
ant.entry(key: "eclipse.preferences.version", value: "1")
ant.entry(key: "warSrcDir", value: "war")
ant.entry(key: "warSrcDirIsOutput", value: "true")
}
}
// populate the WEB-INF/lib folder for running the War plugin
war.doLast {
cleanWarLibDir
populateWarLib
}