-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
143 lines (123 loc) · 3.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
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
apply plugin: 'groovy'
apply plugin: 'java'
apply plugin: 'maven-publish'
sourceCompatibility = 1.8
def mainClass='de.lisaplus.tools.xsd2json.Xsd2JsonSchema'
project.group = 'de.lisaplus.tools'
project.version = '0.1-SNAPSHOT'
def releaseArchiveName = "xsd2jsonSchema_${project.version}.zip"
/*
* the following attributes need to be declared in $HOME/.gradle/gradle.properties
mavenReleaseRepo=http://localhost:8081/content/repositories/releases
mavenSnapshotRepo=http://localhost:8081/content/repositories/snapshots
mavenUser=admin
mavenUserPwd=admin123
mavenBaseRepo=http://localhost:8081/content/groups/public
**/
publishing {
publications {
libraryJar(MavenPublication) {
from components.java
artifact zipRelease
}
}
repositories {
maven {
url "${project.version.endsWith('-SNAPSHOT') ? mavenSnapshotRepo : mavenReleaseRepo }"
credentials {
username = "${mavenUser}"
password = "${mavenUserPwd}"
}
}
}
}
repositories {
mavenLocal()
maven {
url "${mavenBaseRepo}"
}
mavenCentral()
}
artifacts {
archives jar
archives file: new File("$releaseArchiveName"), name: 'xsd2jsonSchema', type: 'zip'
}
dependencies {
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.36'
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.11'
compile group: 'com.beust', name: 'jcommander', version: '1.82'
compile 'org.apache.commons:commons-lang3:3.9'
compile 'org.codehaus.groovy:groovy-all:2.4.21'
compile group: 'com.kjetland', name: 'mbknor-jackson-jsonschema_2.11', version: '1.0.0'
testCompile group: 'junit', name: 'junit', version: '4.13.2'
}
clean {
delete "${buildDir}/release"
}
task dependenciesToLibDir(type: Copy) {
into "$buildDir/release/lib"
from configurations.runtime
}
task buildRelease (type: Copy) {
into "${buildDir}/release/lib"
from "${buildDir}/libs"
copy {
from "${project.rootDir}/src/main/resources/bin"
into "${buildDir}/release"
}
copy {
from "${project.rootDir}/src/main/resources/conf"
into "${buildDir}/release/conf"
}
}
task zipRelease (type: Zip) {
from "${buildDir}/release"
include '*'
include '*/*'
archiveName "$releaseArchiveName"
destinationDir(file("${buildDir}"))
}
task myRun (type: JavaExec, dependsOn: classes){
if(project.hasProperty('myArgs')){
args(myArgs.split(','))
}
if (project.hasProperty('DEBUG')) {
jvmArgs '-Xdebug',
'-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9009'
}
main = mainClass
classpath = sourceSets.main.runtimeClasspath
}
dependenciesToLibDir.dependsOn jar
buildRelease.dependsOn dependenciesToLibDir
configurations {
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
}
sourceSets {
integrationTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/integration_test/java')
}
/* not needed this time
resources.srcDir file('src/integration-test/resources')
*/
}
}
task integrationTest(type: Test) {
doFirst {
// that's the place to init integration tests
}
doLast {
// that's the place to tidy up test integration environment
}
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
outputs.upToDateWhen { false }
}
check.dependsOn integrationTest
integrationTest.mustRunAfter test
buildRelease.dependsOn test
zipRelease.dependsOn buildRelease