Skip to content

Commit cd1ddfa

Browse files
authored
Adding support for Maven Central and updating dependencies (#134)
Can now publish all 3 modules to Maven Central - though I'm not 100% sure about the modules project. publishToMavenLocal works fine, but won't know if Maven Central accepts it until we try it. It's a bit different of course because it contains modules and not Java code, and thus the javadoc jar is empty. Updated all the dependencies to latest versions, most notably Java Client to 5.5.0 and ml-javaclient-util to 4.3.0 (which is not yet published to Maven Central, but will be very soon - likely today). Also updated the marklogic-unit-test-client tests to use JUnit 5 instead of JUnit 4 . This has no impact on users though. Co-authored-by: Rob Rudin <[email protected]>
1 parent 335a313 commit cd1ddfa

File tree

12 files changed

+316
-254
lines changed

12 files changed

+316
-254
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,15 @@ When finished, verify that the self-test works.
124124
To deploy the marklogic-unit-test project by itself, run the following commands:
125125

126126
- cd marklogic-unit-test-client
127-
- gradle mlDeploy
127+
- ../gradlew -i mlDeploy
128128

129-
That process will create an application server on port 8090 (create a file
129+
That process will create an application server on port 8008 (create a file
130130
marklogic-unit-test-client/gradle-local.properties and copy the `mlRestPort` property
131131
to change the port.)
132132

133133
##### Running Tests in the GUI
134134

135-
Point a browser to http://localhost:8090/test/.
135+
Point a browser to http://localhost:8008/test/.
136136

137137
##### Running Tests with Gradle
138138

build.gradle

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
subprojects {
2+
apply plugin: "java-library"
3+
apply plugin: "maven-publish"
4+
apply plugin: "signing"
5+
6+
group = "com.marklogic"
7+
version = "1.1.0-SNAPSHOT"
8+
9+
sourceCompatibility = "8"
10+
targetCompatibility = "8"
11+
12+
repositories {
13+
mavenCentral()
14+
15+
// For local development
16+
mavenLocal()
17+
}
18+
19+
javadoc.failOnError = false
20+
// Ignores warnings on params that don't have descriptions, which is a little too noisy
21+
javadoc.options.addStringOption('Xdoclint:none', '-quiet')
22+
}

gradle.properties

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
1-
group=com.marklogic
2-
version=1.1-SNAPSHOT
1+
# Define these on the command line to publish to OSSRH
2+
# See https://central.sonatype.org/publish/publish-gradle/#credentials for more information
3+
mavenCentralUsername=
4+
mavenCentralPassword=
5+
mavenCentralUrl=https://oss.sonatype.org/service/local/staging/deploy/maven2/
6+
#signing.keyId=YourKeyId
7+
#signing.password=YourPublicKeyPassword
8+
#signing.secretKeyRingFile=PathToYourKeyRingFile

gradle/wrapper/gradle-wrapper.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip
6+
# Using 6.9 until ml-gradle 4.3 is available, which will support 7.x
7+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-bin.zip

marklogic-junit5/build.gradle

Lines changed: 70 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,91 @@
11
plugins {
2-
id "java-library"
3-
id "maven-publish"
4-
id "com.jfrog.bintray" version "1.8.4"
5-
id "com.github.jk1.dependency-license-report" version "1.3"
6-
id "net.saliman.properties" version "1.5.1"
7-
}
8-
9-
sourceCompatibility = "1.8"
10-
targetCompatibility = "1.8"
11-
12-
repositories {
13-
jcenter()
2+
id "com.github.jk1.dependency-license-report" version "1.17"
143
}
154

165
dependencies {
176
api project(":marklogic-unit-test-client")
18-
api "com.marklogic:ml-javaclient-util:4.1.1"
19-
api "jaxen:jaxen:1.1.6"
20-
api "org.junit.jupiter:junit-jupiter-api:5.7.1"
21-
api "org.junit.jupiter:junit-jupiter-params:5.7.1"
22-
api "org.springframework:spring-context:5.2.9.RELEASE"
23-
api "org.springframework:spring-test:5.2.9.RELEASE"
7+
api "com.marklogic:ml-javaclient-util:4.3.0"
8+
api "org.jdom:jdom2:2.0.6"
9+
api "org.junit.jupiter:junit-jupiter-api:5.7.2"
10+
api "org.junit.jupiter:junit-jupiter-params:5.7.2"
11+
api "org.springframework:spring-context:5.3.9"
12+
api "org.springframework:spring-test:5.3.9"
2413
api "com.fasterxml.jackson.core:jackson-databind:2.11.1"
25-
api "org.slf4j:slf4j-api:1.7.30"
14+
api "org.slf4j:slf4j-api:1.7.31"
2615

27-
// Needed by Gradle 4.6+ - see https://www.petrikainulainen.net/programming/testing/junit-5-tutorial-running-unit-tests-with-gradle/
28-
testRuntime "org.junit.jupiter:junit-jupiter-engine:5.7.1"
16+
implementation "jaxen:jaxen:1.2.0"
17+
18+
testImplementation "org.junit.jupiter:junit-jupiter:5.7.2"
2919

3020
// Forcing Spring to use logback instead of commons-logging
31-
testRuntime "ch.qos.logback:logback-classic:1.2.3"
32-
testRuntime group: "org.slf4j", name: "jcl-over-slf4j", version: "1.7.30"
33-
testRuntime group: "org.slf4j", name: "slf4j-api", version: "1.7.30"
21+
testImplementation "ch.qos.logback:logback-classic:1.2.4"
22+
testImplementation "org.slf4j:jcl-over-slf4j:1.7.31"
23+
testImplementation "org.slf4j:slf4j-api:1.7.31"
3424
}
3525

36-
// Needed by Gradle 4.6+ - see https://www.petrikainulainen.net/programming/testing/junit-5-tutorial-running-unit-tests-with-gradle/
3726
test {
3827
useJUnitPlatform()
3928
}
4029

4130
task sourcesJar(type: Jar, dependsOn: classes) {
42-
classifier "sources"
43-
from sourceSets.main.allJava
31+
classifier 'sources'
32+
from sourceSets.main.allSource
4433
}
4534

46-
publishing {
47-
publications {
48-
mainJava(MavenPublication) {
49-
from components.java
50-
artifactId project.name
51-
}
52-
sourcesJava(MavenPublication) {
53-
from components.java
54-
artifactId project.name
55-
artifact sourcesJar
56-
}
57-
}
35+
task javadocJar(type: Jar, dependsOn: javadoc) {
36+
classifier "javadoc"
37+
from javadoc
5838
}
5939

60-
if (project.hasProperty("myBintrayUser")) {
61-
bintray {
62-
user = myBintrayUser
63-
key = myBintrayKey
64-
publications = ["mainJava", "sourcesJava"]
65-
pkg {
66-
repo = "Maven"
67-
name = project.name
68-
userOrg = 'marklogic-community'
69-
licenses = ["Apache-2.0"]
70-
vcsUrl = "https://github.com/marklogic-community/marklogic-unit-test.git"
71-
version {
72-
name = project.version
73-
released = new Date()
74-
}
75-
}
76-
}
40+
artifacts {
41+
archives javadocJar, sourcesJar
42+
}
43+
signing {
44+
sign configurations.archives
45+
}
46+
47+
publishing {
48+
publications {
49+
mainJava(MavenPublication) {
50+
pom {
51+
name = "${group}:${project.name}"
52+
description = "Supports testing MarkLogic applications"
53+
packaging = "jar"
54+
url = "https://github.com/marklogic-community/${project.name}"
55+
licenses {
56+
license {
57+
name = "The Apache License, Version 2.0"
58+
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
59+
}
60+
}
61+
developers {
62+
developer {
63+
id = "marklogic"
64+
name = "MarkLogic Github Contributors"
65+
66+
organization = "MarkLogic"
67+
organizationUrl = "https://www.marklogic.com"
68+
}
69+
}
70+
scm {
71+
url = "[email protected]:marklogic-community/${project.name}.git"
72+
connection = "scm:[email protected]:marklogic-community/${project.name}.git"
73+
developerConnection = "scm:[email protected]:marklogic-community/${project.name}.git"
74+
}
75+
}
76+
from components.java
77+
artifact sourcesJar
78+
artifact javadocJar
79+
}
80+
}
81+
repositories {
82+
maven {
83+
name = "central"
84+
url = mavenCentralUrl
85+
credentials {
86+
username mavenCentralUsername
87+
password mavenCentralPassword
88+
}
89+
}
90+
}
7791
}

marklogic-unit-test-client/build.gradle

Lines changed: 61 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,79 @@
11
plugins {
2-
id "java-library"
3-
id "maven-publish"
4-
id "com.jfrog.bintray" version "1.8.4"
5-
62
// ml-gradle is used for deploying a test application so that this project itself can be tested
7-
id "com.marklogic.ml-gradle" version "3.12.0"
3+
id "com.marklogic.ml-gradle" version "4.2.1"
84

95
// Used to generate a license report
10-
id "com.github.jk1.dependency-license-report" version "1.3"
11-
}
12-
13-
sourceCompatibility = "1.8"
14-
targetCompatibility = "1.8"
15-
16-
repositories {
17-
jcenter()
18-
mavenCentral()
6+
id "com.github.jk1.dependency-license-report" version "1.17"
197
}
208

219
dependencies {
22-
api "com.marklogic:marklogic-client-api:4.1.1"
10+
api "com.marklogic:marklogic-client-api:5.5.0"
11+
implementation "org.slf4j:slf4j-api:1.7.31"
2312

24-
testImplementation "junit:junit:4+"
13+
testImplementation "org.junit.jupiter:junit-jupiter:5.7.2"
2514
}
2615

2716
task sourcesJar(type: Jar, dependsOn: classes) {
28-
classifier "sources"
29-
from sourceSets.main.allJava
17+
classifier 'sources'
18+
from sourceSets.main.allSource
3019
}
3120

32-
// Setup publishing of both a jar (containing the src/main/java code) and the modules zip
33-
// Can eventually include a test jar (containing some src/test/java code) if desired
34-
// Run "gradle publishtomavenlocal" to publish these locally
35-
publishing {
36-
publications {
37-
mainJava(MavenPublication) {
38-
from components.java
39-
artifactId "marklogic-unit-test-client"
40-
}
41-
sourcesJava(MavenPublication) {
42-
from components.java
43-
artifactId "marklogic-unit-test-client"
44-
artifact sourcesJar
45-
}
46-
}
21+
task javadocJar(type: Jar, dependsOn: javadoc) {
22+
classifier "javadoc"
23+
from javadoc
24+
}
25+
26+
artifacts {
27+
archives javadocJar, sourcesJar
28+
}
29+
signing {
30+
sign configurations.archives
4731
}
4832

49-
if (project.hasProperty("myBintrayUser")) {
50-
bintray {
51-
user = myBintrayUser
52-
key = myBintrayKey
53-
publications = ["mainJava", "sourcesJava"]
54-
pkg {
55-
repo = "Maven"
56-
name = project.name
57-
userOrg = 'marklogic-community'
58-
licenses = ["Apache-2.0"]
59-
vcsUrl = "https://github.com/marklogic-community/marklogic-unit-test.git"
60-
version {
61-
name = project.version
62-
released = new Date()
63-
}
64-
}
65-
}
33+
publishing {
34+
publications {
35+
mainJava(MavenPublication) {
36+
pom {
37+
name = "${group}:${project.name}"
38+
description = "Supports testing MarkLogic applications"
39+
packaging = "jar"
40+
url = "https://github.com/marklogic-community/${project.name}"
41+
licenses {
42+
license {
43+
name = "The Apache License, Version 2.0"
44+
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
45+
}
46+
}
47+
developers {
48+
developer {
49+
id = "marklogic"
50+
name = "MarkLogic Github Contributors"
51+
52+
organization = "MarkLogic"
53+
organizationUrl = "https://www.marklogic.com"
54+
}
55+
}
56+
scm {
57+
url = "[email protected]:marklogic-community/${project.name}.git"
58+
connection = "scm:[email protected]:marklogic-community/${project.name}.git"
59+
developerConnection = "scm:[email protected]:marklogic-community/${project.name}.git"
60+
}
61+
}
62+
from components.java
63+
artifact sourcesJar
64+
artifact javadocJar
65+
}
66+
}
67+
repositories {
68+
maven {
69+
name = "central"
70+
url = mavenCentralUrl
71+
credentials {
72+
username mavenCentralUsername
73+
password mavenCentralPassword
74+
}
75+
}
76+
}
6677
}
6778

6879
task createHttpCredentials(type: com.marklogic.gradle.task.MarkLogicTask) {

marklogic-unit-test-client/gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# These properties are used for the test application that ml-gradle deploys so we can test out marklogic-unit-test
22
mlAppName=marklogic-unit-test-testapp
33
mlHost=localhost
4-
mlGradleVersion=4.1.1
54
mlUsername=admin
65
mlPassword=admin
7-
mlRestPort=8090
6+
mlRestPort=8008
7+
mlContentForestsPerHost=1
88

99
# Load both the marklogic-unit-test framework code and some test modules
1010
mlModulePaths=../marklogic-unit-test-modules/src/main/ml-modules,src/test/ml-modules
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
package com.marklogic.test.unit;
22

3-
import org.junit.Assert;
4-
import org.junit.Test;
3+
import org.junit.jupiter.api.Test;
4+
5+
import static org.junit.jupiter.api.Assertions.assertEquals;
56

67
/**
78
* This is included as a demonstration of MarkLogic unit tests being included with non-MarkLogic unit tests in the
89
* same suite.
910
*/
10-
public class NonMarkLogicUnitTest extends Assert {
11+
public class NonMarkLogicUnitTest {
1112

12-
@Test
13-
public void thisShouldSucceed() {
14-
assertEquals("1", "1");
15-
}
13+
@Test
14+
public void thisShouldSucceed() {
15+
assertEquals("1", "1");
16+
}
1617

17-
}
18+
}

0 commit comments

Comments
 (0)