Skip to content

Commit db1943c

Browse files
committed
Added notes about Java version and JAXB usage
1 parent 4f6ec8d commit db1943c

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

README.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ The Java API supports the following core features of the MarkLogic database:
3030
* Call Data Services by means of a Java interface on the client for data functionality
3131
implemented by an endpoint on the server.
3232

33+
The Java API can be used in applications running on Java 8, 11, and 17. If you are using Java 11 or higher and intend
34+
to use [JAXB](https://docs.oracle.com/javase/tutorial/jaxb/intro/), please see the section below for ensuring that the
35+
necessary dependencies are available in your application's classpath.
36+
3337
## QuickStart
3438

3539
To use the API in your [Maven](https://maven.apache.org/) project, include the following in your pom.xml file:
@@ -83,8 +87,28 @@ as the one that includes the marklogic-client-api dependency):
8387

8488
You are free to use any implementation of JAXB that you wish, but you need to ensure that you're using a JAXB
8589
implementation that corresponds to the `javax.xml.bind` interfaces. JAXB 3.0 and 4.0 interfaces are packaged under
86-
`jakarta.xml.bind`, and the Java API does not yet depend on those interfaces. You are thus free to include an
87-
implementation of JAXB 3.0 or 4.0 in your project for your own use; it will not affect the Java API.
90+
`jakarta.xml.bind`, and the Java API does not yet depend on those interfaces.
91+
92+
Thus, you are free to include an implementation of JAXB 3.0 or 4.0 in your project for your own use; it will not
93+
affect the Java API. A caveat though is if you are trying to use different major versions of the same JAXB
94+
implementation library - such as `org.glassfish.jaxb:jaxb-runtime` - then you will run into an expected dependency
95+
conflict between the two versions of the library. This can be worked around by using a different implementation of
96+
JAXB 3.0 or JAXB 4.0 - for example:
97+
98+
dependencies {
99+
// JAXB 2 dependencies required by Java Client
100+
implementation "javax.xml.bind:jaxb-api:2.3.1"
101+
implementation "org.glassfish.jaxb:jaxb-runtime:2.3.2"
102+
implementation "org.glassfish.jaxb:jaxb-core:2.3.0.1"
103+
104+
// JAXB 4 dependencies required by other application code
105+
implementation "jakarta.xml.bind:jakarta.xml.bind-api:4.0.0"
106+
implementation "com.sun.xml.bind:jaxb-impl:4.0.1"
107+
}
108+
109+
The Java Client will soon be updated to use the newer `jakarta.xml.bind` interfaces. Until then, the above approach
110+
or one similar to it will allow for both the old and new JAXB interfaces and implementations to exist together in the
111+
same classpath.
88112

89113
### Learning More
90114

0 commit comments

Comments
 (0)