-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy pathbuild.gradle
More file actions
234 lines (201 loc) · 9.18 KB
/
build.gradle
File metadata and controls
234 lines (201 loc) · 9.18 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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
/*
* Copyright (c) 2010-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
*/
plugins {
id 'java-library'
id 'maven-publish'
}
group = 'com.marklogic'
description = "The official MarkLogic Java client API."
dependencies {
// Using the latest version now that the 8.0.0 release requires Java 17.
// This is now an implementation dependency as opposed to an api dependency in 7.x and earlier.
// The only time it appears in the public API is when a user uses JAXBHandle.
// But in that scenario, the user would already be using JAXB in their application.
implementation "jakarta.xml.bind:jakarta.xml.bind-api:4.0.4"
implementation "org.glassfish.jaxb:jaxb-runtime:4.0.6"
implementation "com.squareup.okhttp3:okhttp:${okhttpVersion}"
implementation "com.squareup.okhttp3:logging-interceptor:${okhttpVersion}"
implementation 'io.github.rburgst:okhttp-digest:3.1.1'
// We tried upgrading to the org.eclipse.angus:angus-mail dependency, but we ran into significant performance issues
// with using the Java Client eval call in our Spark connector. Example - an eval() call for getting 50k URIs would
// take 50s instead of 2 to 3s. Haven't dug into the details, but seems like the call isn't lazy and the entire set
// of URIs is being retrieved. This implementation - in the old "com.sun.mail" package but still adhering to the new
// jakarta.mail API - works fine and performs well for eval calls.
// As of the 8.0.0 release - this still is a good solution, particularly as com.sun.mail:jakarta.mail received a
// recent patch release and is therefore still being maintained.
implementation "com.sun.mail:jakarta.mail:2.0.2"
implementation 'org.slf4j:slf4j-api:2.0.17'
implementation "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-csv:${jacksonVersion}"
// Only used by extras (which some examples then depend on)
compileOnly 'org.jdom:jdom2:2.0.6.1'
compileOnly 'org.dom4j:dom4j:2.2.0'
compileOnly 'com.google.code.gson:gson:2.13.2'
testImplementation 'org.junit.jupiter:junit-jupiter:5.13.4'
// Forcing junit version to avoid vulnerability with older version in xmlunit
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.xmlunit:xmlunit-legacy:2.10.4'
testImplementation project(':examples')
testImplementation 'org.apache.commons:commons-lang3:3.19.0'
// Allows talking to the Manage API.
testImplementation ("com.marklogic:ml-app-deployer:6.0.1") {
exclude module: "marklogic-client-api"
}
// Starting with mockito 5.x, Java 11 is required, so sticking with 4.x as we have to support Java 8.
testImplementation "org.mockito:mockito-core:4.11.0"
testImplementation "org.mockito:mockito-inline:4.11.0"
testImplementation "com.squareup.okhttp3:mockwebserver3:5.1.0"
testImplementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:${jacksonVersion}"
testImplementation 'ch.qos.logback:logback-classic:1.5.18'
// Using this to avoid a schema validation issue with the regular xercesImpl
testImplementation 'org.opengis.cite.xerces:xercesImpl-xsd11:2.12-beta-r1667115'
testImplementation('com.opencsv:opencsv:5.12.0') {
// Excluding this due to a security vulnerability, and the test for the example that uses this library
// passes without this on the classpath.
exclude module: "commons-beanutils"
}
testImplementation 'org.skyscreamer:jsonassert:1.5.3'
// Automatic loading of test framework implementation dependencies is deprecated.
// https://docs.gradle.org/current/userguide/upgrading_version_8.html#test_framework_implementation_dependencies
// Without this, once using JUnit 5.12 or higher, Gradle will not find any tests and report an error of:
// org.junit.platform.commons.JUnitException: TestEngine with ID 'junit-jupiter' failed to discover tests
testRuntimeOnly "org.junit.platform:junit-platform-launcher:1.13.4"
}
// Ensure that mlHost and mlPassword can override the defaults of localhost/admin if they've been modified
test {
useJUnitPlatform()
systemProperty "TEST_HOST", mlHost
systemProperty "TEST_ADMIN_PASSWORD", mlPassword
// Needed by the tests for the example programs
systemProperty "EXAMPLE_HOST", mlHost
systemProperty "EXAMPLE_ADMIN_PASSWORD", mlPassword
systemProperty "TEST_USE_REVERSE_PROXY_SERVER", testUseReverseProxyServer
}
task sourcesJar(type: Jar) {
archiveClassifier = 'sources'
exclude ('property', '*.xsd', '*.xjb')
from sourceSets.main.allSource
}
javadoc {
maxMemory="6000m"
options.overview = "src/main/javadoc/overview.html"
options.windowTitle = "$rootProject.describedName $rootProject.version"
options.docTitle = "$rootProject.describedName $rootProject.version"
options.bottom = "Copyright (c) 2010-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved."
options.links = [ 'http://docs.oracle.com/javase/8/docs/api/' ]
options.use = true
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html4', true)
}
exclude([
'**/impl/**', '**/jaxb/**', '**/test/**'
])
// workaround for bug in options.docFilesSubDirs = true
doLast{
copy{
from "${projectDir}/src/main/javadoc/doc-files"
into "${buildDir}/docs/javadoc/doc-files"
}
}
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}
Node pomCustomizations = new NodeBuilder(). project {
name "$rootProject.describedName"
packaging 'jar'
textdescription "$project.description"
url 'https://github.com/marklogic/java-client-api'
scm {
url 'git@github.com:marklogic/java-client-api.git'
connection 'scm:git:git@github.com:marklogic/java-client-api.git'
developerConnection 'scm:git:git@github.com:marklogic/java-client-api.git'
}
licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
name 'MarkLogic'
email 'java-sig@marklogic.com'
organization 'MarkLogic'
organizationUrl 'https://www.marklogic.com'
}
developer {
name 'MarkLogic Github Contributors'
email 'general@developer.marklogic.com'
organization 'Github Contributors'
organizationUrl 'https://github.com/marklogic/java-client-api/graphs/contributors'
}
}
}
publishing {
publications {
mainJava(MavenPublication) {
from components.java
pom.withXml {
asNode().append(pomCustomizations.packaging)
asNode().append(pomCustomizations.name)
asNode().appendNode("description", pomCustomizations.textdescription.text())
asNode().append(pomCustomizations.url)
asNode().append(pomCustomizations.licenses)
asNode().append(pomCustomizations.developers)
asNode().append(pomCustomizations.scm)
}
artifact sourcesJar
artifact javadocJar
}
}
repositories {
maven {
if(project.hasProperty("mavenUser")) {
credentials {
username mavenUser
password mavenPassword
}
}
url = publishUrl
}
}
}
task printClassPath() {
doLast {
println sourceSets.main.runtimeClasspath.asPath+':'+sourceSets.test.runtimeClasspath.asPath
}
}
task generatePomForDependencyGraph(dependsOn: "generatePomFileForMainJavaPublication") {
description = "Prepare for a release by making a copy of the generated pom file in the root directory so that it " +
"can enable Github's Dependency Graph feature, which does not yet support Gradle"
doLast {
def preamble = '<?xml version="1.0" encoding="UTF-8"?>'
def comment = "<!--\n" +
"This file was generated via Gradle and is being used primarily for github's Dependency Graph feature.\n" +
"It is not intended to be used to build this project.\n" +
"-->"
def fileText = file("build/publications/mainJava/pom-default.xml").getText()
file("../pom.xml").setText(fileText.replace(preamble, preamble + comment))
}
}
task testRows(type: Test) {
useJUnitPlatform()
description = "Run all 'rows' tests; i.e. those exercising Optic and Optic Update functionality"
include "com/marklogic/client/test/rows/**"
}
task debugCloudAuth(type: JavaExec) {
description = "Test program for manual testing of cloud-based authentication against a Progress Data Cloud instance"
mainClass = 'com.marklogic.client.test.MarkLogicCloudAuthenticationDebugger'
classpath = sourceSets.test.runtimeClasspath
args = [cloudHost, cloudKey, cloudBasePath]
}
task runXmlSmokeTests(type: Test) {
description = "Run a bunch of XML-related tests for smoke-testing on a particular JVM"
include "com/marklogic/client/test/BufferableHandleTest.class"
include "com/marklogic/client/test/EvalTest.class"
include "com/marklogic/client/test/HandleAsTest.class"
include "com/marklogic/client/test/JAXBHandleTest.class"
}