-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
59 lines (51 loc) · 1.75 KB
/
build.gradle
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
buildscript {
repositories {
jcenter()
}
dependencies {
classpath(group: 'com.sahlbach.gradle', name: 'gradle-jetty-eclipse-plugin', version: '1.9.+')
}
}
apply plugin: 'jettyEclipse'
apply plugin: 'war'
apply plugin: 'eclipse-wtp'
// Define souce code compatibility
sourceCompatibility = 1.7
targetCompatibility = 1.7
// Use maven repository
repositories {
mavenCentral()
}
// Fills out all dependencies which are necessary to start the embedded jetty into our war file
configurations {
embeddedJetty
}
dependencies {
embeddedJetty 'org.eclipse.jetty:jetty-servlet:+'
embeddedJetty 'org.eclipse.jetty:jetty-webapp:+'
embeddedJetty 'org.eclipse.jetty:jetty-jsp:+'
embeddedJetty 'org.eclipse.jetty:jetty-annotations:+'
}
war {
// unzip and add all jetty dependencies into the root of our war file
from {
configurations.embeddedJetty.collect {
project.zipTree(it)
}
}
// remove signature and unnecessary files
exclude "META-INF/*.SF", "META-INF/*.RSA", "about.html", "about_files/**", "readme.txt", "plugin.properties", "jetty-dir.css"
// include only the classes which will be used to start Embedded Jetty
from "$buildDir/classes/main"
exclude "com/myapp/"
// tells the class to run when the generate war be executed using 'java -jar'
manifest { attributes 'Main-Class': 'com.embedded.JettyStarter' }
}
// Once you will need some basic api (e.i. servlet api) for compilation, add embeddedJetty dependencies for compilation
sourceSets.main.compileClasspath += configurations.embeddedJetty
// the same for eclipse classpath, so you can use it to edit your java files
eclipse {
classpath {
plusConfigurations += configurations.embeddedJetty
}
}