-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle
More file actions
187 lines (163 loc) · 6.43 KB
/
Copy pathbuild.gradle
File metadata and controls
187 lines (163 loc) · 6.43 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
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
import groovy.xml.QName
task wrapper(type: Wrapper) {
gradleVersion = '2.0'
}
repositories {
mavenCentral() // needed for nexus-workflow plugin and license-gradle-plugin
}
apply plugin: 'java'
compileJava.options.encoding = 'utf-8'
compileJava.sourceCompatibility = JavaVersion.VERSION_1_6
compileJava.targetCompatibility = JavaVersion.VERSION_1_6
compileTestJava.options.encoding = 'utf-8'
compileTestJava.sourceCompatibility = JavaVersion.VERSION_1_6
compileTestJava.targetCompatibility = JavaVersion.VERSION_1_6
apply plugin: 'findbugs'
findbugs {
sourceSets = [project.sourceSets.main] // check only main classes, neither tests nor example workflow classes
excludeFilter = file("$rootDir/common/findbugs-exclude-filter.xml")
effort = "max"
ignoreFailures = true
}
tasks.withType(FindBugs) {
reports {
// Unfortunately FindBugs cannot emit both XML and HTML report simultanously, so by default we emit HTML only.
// We emit XML only when -PfindbugsXmlReportEnabled=true, e.g. during Jenkins build
def findbugsXmlReportEnabled = project.hasProperty('findbugsXmlReportEnabled') && project.property('findbugsXmlReportEnabled')
xml.enabled = findbugsXmlReportEnabled
html.enabled = !findbugsXmlReportEnabled
}
}
apply plugin: 'eclipse'
eclipse {
classpath {
defaultOutputDir = file('build')
file {
//exclude slf4f log binding from export
withXml {
Node root = it.asNode()
NodeList nodeList = root.getAt(new QName('classpathentry'))
nodeList.each { Node classpathentry ->
if (classpathentry.attributes().path.contains('slf4j-log4j12')) {
classpathentry.attributes().remove('exported')
}
}
}
}
}
jdt {
file {
// add our code style settings to every eclipse project
withProperties { properties ->
def codestyle = new XmlParser().parse(file("$rootDir/common/eclipse-codestyle.xml"))
codestyle.profile[0].setting.each {
properties.put(it.'@id', it.'@value')
}
}
whenMerged {
def uiprops = new Properties();
uiprops.put('eclipse.preferences.version', '1')
uiprops.put('formatter_profile', '_SCOOP-CodeStyle')
uiprops.put('formatter_settings_version', '12')
uiprops.store(file("$projectDir/.settings/org.eclipse.jdt.ui.prefs").newWriter(), "generated by build.gradle")
}
}
}
}
// be sure to always regenerate eclipse files, because default behavior is merging into existing files
tasks.eclipse.dependsOn cleanEclipse
eclipse.classpath.defaultOutputDir = new File("$buildDir/classes/main")
sourceSets {
workflow {
ext.srcDir = "$projectDir/src/workflow/java"
}
}
sourceSets.main.resources.srcDirs += sourceSets.workflow.srcDir
configurations {
wsgen
}
sourceSets {
schema {
ext.srcDir = "$projectDir/src/main/schema"
}
}
sourceSets.main.resources.srcDirs += sourceSets.schema.srcDir
dependencies {
compile 'log4j:log4j:1.2.17'
compile 'org.slf4j:slf4j-api:1.7.7'
compile 'org.slf4j:slf4j-simple:1.7.7'
compile 'org.copper-engine:copper-coreengine:3.2.1'
compile 'org.copper-engine:copper-jmx-interface:3.2.1'
compile 'org.copper-engine:copper-spring:3.2.1'
compile 'org.apache.derby:derby:10.10.1.1'
compile 'log4j:log4j:1.2.17'
compile 'org.slf4j:slf4j-api:1.7.5'
compile('org.apache.cxf:cxf-rt-transports-http-jetty:2.5.3') {
exclude module: 'spring-web'
}
compile('org.apache.cxf:cxf-rt-frontend-jaxws:2.5.3') {
exclude module: 'spring-web'
}
compile 'org.eclipse.jetty:jetty-server:7.5.4.v20111024'
compile 'commons-lang:commons-lang:2.6'
testCompile 'junit:junit:4.11'
testCompile 'org.mockito:mockito-all:1.9.5'
wsgen 'org.apache.cxf:cxf-tools-wsdlto-core:2.6.0'
wsgen 'org.apache.cxf:cxf-tools-wsdlto-frontend-jaxws:2.6.0'
wsgen 'org.apache.cxf:cxf-tools-wsdlto-databinding-jaxb:2.6.0'
wsgen 'org.apache.cxf:cxf-xjc-ts:2.2.12'
wsgen 'com.sun.xml.bind:jaxb-xjc:2.2.4-1'
}
tasks.create(name: "gen_wsbindings") {
ext.genDirName = "$projectDir/src/main/generated";
inputs.dir file(sourceSets.schema.srcDir)
outputs.dir file(ext.genDirName)
doFirst {
file(ext.genDirName).mkdirs()
}
doLast {
fileTree(dir: sourceSets.schema.srcDir + "/wsdl", include: "**/*.wsdl", exclude: "common.wsdl").each {
def wsdlFile ->
javaexec {
main = 'org.apache.cxf.tools.wsdlto.WSDLToJava'
classpath = configurations.wsgen
// Add -DexitOnFinish=true so that WSDLToJava bails out with exit code 0 (on success) or 1 (on failure)
// so that the build aborts immediately on errors. If you don't set this property, the exit code is always 0.
systemProperty 'exitOnFinish', 'true'
args = ['-frontend', 'jaxws21',
'-db', 'jaxb',
'-xjc-extension',
'-impl', '-server', '-client', '-validate',
'-d', ext.genDirName,
'-wsdlLocation', 'classpath:wsdl/' + wsdlFile.name,
wsdlFile]
}
}
}
}
sourceSets.main.java.srcDirs += gen_wsbindings.genDirName
compileJava.dependsOn gen_wsbindings
eclipseClasspath.dependsOn gen_wsbindings
jar {
manifest.attributes provider: 'gradle'
}
// task addMissingLicenseHeaders {
// println "Replacing java source file headers in " + project.path
//
// def licenseFile = file("$rootDir/common/apache-license-file.txt")
// ant.loadfile(srcFile: licenseFile, property: 'licenseHeader')
// def licenseHeader = "${ant.properties['licenseHeader']}"
//
// ant.replaceregexp(match: '(/\\*.*\\*/.*)??^package ', flags: 'sm', replace: licenseHeader + "package ") {
// fileset(dir: "$projectDir/src") {
// include(name: '**/*.java')
// }
// }
// }
javadoc {
options.encoding = "UTF-8"
}
task runHello (type: JavaExec, dependsOn: classes){
classpath = sourceSets.main.runtimeClasspath
main = "org.cooperengine.examples.simple.HelloWorldTestApplication"
}