forked from ibm-messaging/mq-jms-spring
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
203 lines (177 loc) · 7 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
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
/*
* Copyright 2018,2020 IBM Corp. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
/*
* This file shows how to build various artifacts for linking IBM MQ with Spring.
*
*/
subprojects {
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'signing'
// Direct Dependencies - give versions here
ext.mqVersion = '9.1.5.0'
ext.springVersion = '5.2.6.RELEASE'
ext.springBootVersion = '2.3.0.RELEASE'
ext.pooledJmsVersion = '1.1.1'
ext.jUnitVersion = '4.13'
// The groupid for the compiled jars when uploaded
group = 'com.ibm.mq'
// The designated version is in an external file. Read its contents here.
version = new File(rootDir, 'VERSION').text.trim()
// If the version says "snapshot" anywhere assume it is not a release. If property or environment var is set,
// then push to a Maven repository (usually to Central) otherwise, keep in a local directory.
ext.pushProperty = 'PushToMaven'
ext.isReleaseVersion = !version.toUpperCase(Locale.ENGLISH).contains("SNAPSHOT")
ext.isLocalDeploy = ((System.getProperty(pushProperty) == null) && (System.getenv(pushProperty) == null)) ||
version.toUpperCase(Locale.ENGLISH).contains("LOCAL")
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenLocal()
//maven { url "https://repo.spring.io/snapshot" }
//maven { url "https://repo.spring.io/milestone" }
mavenCentral()
}
dependencies {
// MQ Java client accessed from Maven Central Repository
compile group: 'com.ibm.mq', name: 'com.ibm.mq.allclient', version: mqVersion
// Spring
compile group: 'org.springframework', name: 'spring-core', version: springVersion
compile group: 'org.springframework', name: 'spring-context', version: springVersion
compile group: 'org.springframework', name: 'spring-beans', version: springVersion
compile group: 'org.springframework', name: 'spring-jms', version: springVersion
compile group: 'org.springframework.boot', name: 'spring-boot-starter', version: springBootVersion
//pool
compile group: 'org.messaginghub', name: 'pooled-jms', version: pooledJmsVersion
// Testing
testCompile group: 'junit', name: 'junit', version: jUnitVersion
testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: springBootVersion
}
// Include variable debug info in the compiled classes
compileJava.options.debugOptions.debugLevel = "source,lines,vars"
// Fail on javac warnings
compileJava.options.compilerArgs << "-Werror"
// Always UTF-8
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
sourceSets.all {
into(name + "/java", { from allJava })
into(name + "/resources", { from resources })
}
}
javadoc {
options.encoding 'UTF-8'
options.setMemberLevel JavadocMemberLevel.PROTECTED
// Add a logging listener to check for javadoc warnings and fail the build if there are any
boolean hasJavaDocWarnings = false;
doFirst {
getLogging().addStandardErrorListener(new StandardOutputListener() {
void onOutput(CharSequence output) {
if (output =~ "warning:") {
hasJavaDocWarnings = true
}
}
})
}
doLast {
if (hasJavaDocWarnings) {
throw new GradleException("Build failed due to javadoc warnings.");
}
}
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar, javadocJar
}
// Load signing parameters from external properties
// This will probably be a "gradle.properties" file in this directory
['signing.keyId', 'signing.password', 'signing.secretKeyRingFile']
.each { propName ->
//set a property with the given name if the system property is set
//if the system property is not set then set the property to null if it isn't a signing one
if (System.properties.(propName.toString()) != null || !propName.startsWith("signing")) {
ext.(propName.toString()) = System.properties.(propName.toString())
}
}
signing {
// Only apply signing when it is a release and is being published to a real repository
required {
isReleaseVersion && !isLocalDeploy && gradle.taskGraph.hasTask("uploadArchives")
}
// When signing, sign the archives
if (!isLocalDeploy) {
sign configurations.archives
}
}
uploadArchives {
repositories {
mavenDeployer {
// When publishing sign the pom
if (!isLocalDeploy) {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
}
if (isLocalDeploy) {
def localMavenRepo = 'file://' + new File(System.getProperty('user.home'), '.m2/repository').absolutePath
repository(url: localMavenRepo)
} else {
// The gradle.properties file contains the username and password for Nexus deployment
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
}
// Augment the pom with additional information
pom.project {
name rootProject.name
description 'Spring configuration for the official IBM MQ library for Java'
inceptionYear '2018'
packaging 'jar'
url 'https://github.com/ibm-messaging/mq-jms-spring'
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
scm {
connection 'scm:git:git://github.com/ibm-messaging/mq-jms-spring.git'
developerConnection 'scm:git:[email protected]/ibm-messaging/mq-jms-spring.git'
url 'https://github.com/ibm-messaging/mq-jms-spring.git'
}
properties {
'project.build.sourceEncoding' 'UTF-8'
}
developers {
developer {
name 'IBM MQ'
url 'https://ibm.com/software/products/en/ibm-mq'
organization 'IBM'
organizationUrl 'http://www.ibm.com'
}
}
}
}
}
}
}