This repository has been archived by the owner on Sep 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
/
build.gradle
199 lines (176 loc) · 5.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
plugins {
id "java-library"
id "maven-publish"
id "signing"
id "com.github.jk1.dependency-license-report" version "1.17"
id "net.saliman.properties" version "1.5.2"
id "io.snyk.gradle.plugin.snykplugin" version "0.4"
}
group = "com.marklogic"
version = "4.8.0"
java {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
repositories {
mavenLocal()
mavenCentral()
maven {
url "https://bed-artifactory.bedford.progress.com:443/artifactory/ml-maven-snapshots/"
}
}
dependencies {
api 'com.marklogic:ml-javaclient-util:4.8.0'
api 'org.springframework:spring-web:5.3.34'
api 'com.fasterxml.jackson.core:jackson-databind:2.15.3'
implementation 'jaxen:jaxen:1.2.0'
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
implementation 'io.github.rburgst:okhttp-digest:2.7'
implementation 'org.apache.httpcomponents:httpclient:4.5.14'
implementation 'org.jdom:jdom2:2.0.6.1'
// Forcing httpclient to use this to address https://snyk.io/vuln/SNYK-JAVA-COMMONSCODEC-561518
implementation 'commons-codec:commons-codec:1.16.1'
// For EqualsBuilder; added in 3.8.1 to support detecting if a mimetype's properties have changed or not
implementation "org.apache.commons:commons-lang3:3.14.0"
// For PreviewInterceptor; can be excluded if that feature is not used
implementation("com.flipkart.zjsonpatch:zjsonpatch:0.4.16") {
// Prefer the api version declared above
exclude module: "jackson-databind"
}
// Required for Java 11
implementation "javax.xml.bind:jaxb-api:2.3.1"
implementation "com.sun.xml.bind:jaxb-core:2.3.0.1"
implementation "com.sun.xml.bind:jaxb-impl:2.3.7"
// Don't want to include this in the published jar, just the executable jar
compileOnly "com.beust:jcommander:1.82"
compileOnly "ch.qos.logback:logback-classic:1.3.14"
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.2'
testImplementation 'org.springframework:spring-test:5.3.34'
testImplementation 'commons-io:commons-io:2.16.1'
testImplementation 'xmlunit:xmlunit:1.6'
// Forcing Spring to use logback for testing instead of commons-logging
testImplementation "ch.qos.logback:logback-classic:1.3.14"
testImplementation "org.slf4j:jcl-over-slf4j:2.0.13"
testImplementation "org.slf4j:slf4j-api:2.0.13"
}
// This ensures that Gradle includes in the published jar any non-java files under src/main/java
sourceSets.main.resources.srcDir 'src/main/java'
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
// For unknown reasons, Gradle 7.1 (but not 6.x) is complaining that AbstractManager.java is a duplicate.
duplicatesStrategy = "exclude"
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier = "javadoc"
from javadoc
}
javadoc.failOnError = false
artifacts {
archives javadocJar, sourcesJar
}
signing {
sign configurations.archives
}
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))
}
}
publishing {
publications {
mainJava(MavenPublication) {
pom {
name = "${group}:${project.name}"
description = "Java client for the MarkLogic REST Management API and for deploying applications to MarkLogic"
packaging = "jar"
url = "https://github.com/marklogic-community/${project.name}"
licenses {
license {
name = "The Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
id = "marklogic"
name = "MarkLogic Github Contributors"
email = "[email protected]"
organization = "MarkLogic"
organizationUrl = "https://www.marklogic.com"
}
}
scm {
url = "[email protected]:marklogic/${project.name}.git"
connection = "scm:[email protected]:marklogic/${project.name}.git"
developerConnection = "scm:[email protected]:marklogic/${project.name}.git"
}
}
from components.java
artifact sourcesJar
artifact javadocJar
}
}
repositories {
maven {
if (project.hasProperty("mavenUser")) {
credentials {
username mavenUser
password mavenPassword
}
url publishUrl
} else {
name = "central"
url = mavenCentralUrl
credentials {
username mavenCentralUsername
password mavenCentralPassword
}
}
}
}
}
test {
useJUnitPlatform()
testLogging {
events 'started','passed', 'skipped', 'failed'
exceptionFormat 'full'
}
}
task executableJar(type: Jar) {
description = "Construct an executable jar for executing ml-app-deployer commands via the command line"
archiveBaseName = "deployer"
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
manifest {
attributes("Main-Class": "com.marklogic.appdeployer.cli.Main")
}
// Include this project's class files
from sourceSets.main.output
// Include all project dependencies
from {
configurations.compileClasspath.collect {
it.isDirectory() ? it : zipTree(it)
}
}
from {
configurations.runtimeClasspath.collect {
it.isDirectory() ? it : zipTree(it)
}
}
}
// See https://github.com/snyk/gradle-plugin for more information
snyk {
//arguments = '--all-sub-projects'
severity = 'low'
api = snykToken
autoDownload = true
autoUpdate = true
}