Skip to content

Commit 6e55c0f

Browse files
Resolves build issues relating to Java 8/9+ compatibility. Updates Gradle and various test dependencies to latest versions. Updates README for 4.1.0 release.
1 parent c5f733f commit 6e55c0f

File tree

5 files changed

+70
-43
lines changed

5 files changed

+70
-43
lines changed

README.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@ HashiCorp.
55

66
This driver strives to implement Vault's full HTTP API, along with supporting functionality such as automatic
77
retry handling. It does so without relying on any other external libraries beyond the Java standard library,
8-
and is compatible with Java 7 and up. So it will play nice with all of your projects, greenfield and legacy
8+
and is compatible with Java 8 and up. So it will play nice with all of your projects, greenfield and legacy
99
alike, without causing conflicts with any other dependency.
1010

11+
NOTE: Although the binary artifact produced by the project is backwards-compatible with Java 8, you do need
12+
JDK 9 or higher to modify or build the source code of this library itself.
13+
1114
Table of Contents
1215
-----------------
1316
* [Installing the Driver](#installing-the-driver)
@@ -31,7 +34,7 @@ The driver is available from Maven Central, for all modern Java build systems.
3134
Gradle:
3235
```
3336
dependencies {
34-
implementation 'com.bettercloud:vault-java-driver:4.0.0'
37+
implementation 'com.bettercloud:vault-java-driver:4.1.0'
3538
}
3639
```
3740

@@ -40,7 +43,7 @@ Maven:
4043
<dependency>
4144
<groupId>com.bettercloud</groupId>
4245
<artifactId>vault-java-driver</artifactId>
43-
<version>4.0.0</version>
46+
<version>4.1.0</version>
4447
</dependency>
4548
```
4649

@@ -249,11 +252,22 @@ Note that changes to the major version (i.e. the first number) represent possibl
249252
may require modifications in your code to migrate. Changes to the minor version (i.e. the second number)
250253
should represent non-breaking changes. The third number represents any very minor bugfix patches.
251254

255+
* **4.1.0**: This release contains the following update:
256+
* Support for JWT authentication, for use by Kubernetes and other JWT-based authentication providers. [(PR #164)](https://github.com/BetterCloud/vault-java-driver/pull/164)
257+
* Updates the lease revoke method, to support changes in the underlying Vault API. [(PR #163)](https://github.com/BetterCloud/vault-java-driver/pull/163)
258+
* Changes the `VaultConfig.secretsEnginePathMap(...)` method from default access level to `public`, to allow for manual
259+
setting [(PR #164)](https://github.com/BetterCloud/vault-java-driver/pull/156)
260+
* Adds the nonce value to `AuthResponse`, to facilitate re-authentication with Vault via AWS. [(PR #168)](https://github.com/BetterCloud/vault-java-driver/pull/168)
261+
* Establishes a `module-info` file, updates the JDK requirement for building this library to Java 9 (although the built
262+
library artifact remains compatible as a dependency in Java 8 projects). [(PR #165)](https://github.com/BetterCloud/vault-java-driver/pull/165)
263+
* Updates Gradle, and various test dependencies to their latest versions. Integration tests now target Vault 1.1.3.
264+
252265
* **4.0.0**: This is a breaking-change release, with two primary updates:
253266
* Adds support for Version 2 of the Key/Value Secrets Engine. The driver now assumes that your Vault instance uses Version 2 of the
254267
Key/Value Secrets Engine across the board. To configure this, see the [Key/Value Secret Engine Config](#key-value-secret-engine-config)
255268
section above.
256269
* Adds support for the namespaces feature of Vault Enterprise.
270+
257271
* **3.1.0**: Several updates.
258272
* Adds support for seal-related operations (i.e. `/sys/seal`, `/sys/unseal`, `/sys/seal-status`).
259273
* Adds support for the AWS auth backend.
@@ -358,6 +372,10 @@ Unit tests are located under the `src/test` directory, and can be run with the G
358372
Integration tests are located under the `src/test-integration` directory, and can be run with the Gradle
359373
`integrationTest` task. See the additional `README.md` file in this directory for more detailed information.
360374

375+
Although this library now includes a `module-info` class for use by Java 9+, the library currently targets
376+
Java 8 compatibility. Please do not attempt to introduce any features or syntax not compatible with Java 8 (the
377+
Gradle build script should prevent you from doing so without modification).
378+
361379
License
362380
-------
363381
The MIT License (MIT)

build.gradle

Lines changed: 46 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,54 +7,64 @@ archivesBaseName = 'vault-java-driver'
77
version '4.1.0'
88
ext.isReleaseVersion = !version.endsWith('SNAPSHOT')
99

10-
compileJava {
11-
sourceCompatibility = 1.8
12-
targetCompatibility = 1.8
13-
}
14-
15-
sourceSets {
16-
main {
17-
java {
18-
exclude 'module-info.java'
19-
}
20-
}
21-
mainModuleInfo {
22-
java {
23-
srcDirs = ['src/main/java']
24-
outputDir = file("$buildDir/classes/java/main")
25-
include 'module-info.java'
26-
}
27-
}
28-
}
29-
30-
classes.dependsOn mainModuleInfoClasses
31-
compileMainModuleInfoJava.options.compilerArgs.addAll(['--release', '9'])
32-
33-
compileTestJava {
34-
sourceCompatibility = 1.8
35-
targetCompatibility = 1.8
36-
}
10+
// This project is actually limited to Java 8 compatibility. See below.
11+
sourceCompatibility = 9
12+
targetCompatibility = 9
3713

3814
repositories {
3915
mavenCentral()
4016
}
4117

4218
dependencies {
4319
testCompile('junit:junit:4.12')
44-
testCompile('org.mockito:mockito-core:2.23.4')
45-
testCompile('org.testcontainers:testcontainers:1.6.0')
46-
testCompile('org.eclipse.jetty:jetty-server:9.4.14.v20181114')
47-
testCompile('org.slf4j:slf4j-api:1.7.25')
48-
testCompile('org.bouncycastle:bcprov-jdk15on:1.60')
49-
testCompile('org.bouncycastle:bcpkix-jdk15on:1.60')
20+
testCompile('org.mockito:mockito-core:2.28.2')
21+
testCompile('org.testcontainers:testcontainers:1.11.3')
22+
testCompile('org.eclipse.jetty:jetty-server:9.4.19.v20190610')
23+
testCompile('org.slf4j:slf4j-api:1.7.26')
24+
testCompile('org.bouncycastle:bcprov-jdk15on:1.62')
25+
testCompile('org.bouncycastle:bcpkix-jdk15on:1.62')
26+
testCompile('org.apache.commons:commons-io:1.3.2')
5027

51-
testRuntime('org.slf4j:slf4j-simple:1.7.25')
28+
testRuntime('org.slf4j:slf4j-simple:1.7.26')
5229
}
5330

54-
task wrapper(type: Wrapper) {
55-
gradleVersion = '4.10.2'
31+
// Beginning of Java 9 compatibility config
32+
//
33+
// Allowing a library to support Java 9+ modularity, while also maintaining backwards-compatibility for Java 8 users, is WAY more
34+
// tricky than expected! The lines below are adapted from a blog article (https://dzone.com/articles/building-java-6-8-libraries-for-jpms-in-gradle),
35+
// and cause the built classes to support a Java 8 JRE, while also including a module definition suitable for use with Java 9. There are a
36+
// few considerations that come with this:
37+
//
38+
// * You now need JDK 9 or higher to BUILD this library. You can still USE the built artifact as a dependency in a Java 8 project.
39+
// * Although "sourceCompatibility" and "targetCompatability" above are set for Java 9, the "compileJava" settings below will not
40+
// allow you to build with any code changes that are not Java 8 compatible.
41+
// * Unfortunately, IntelliJ (and perhaps other IDE's?) will show syntax highlighting, code completion tips, etc for Java 9. Sorry for
42+
// the inconvenience. In any case, you should not commit changes to source control without confirming that the project builds.
43+
compileJava {
44+
exclude 'module-info.java'
45+
46+
options.compilerArgs = ['--release', '8']
47+
}
48+
49+
task compileModuleInfoJava(type: JavaCompile) {
50+
classpath = files()
51+
source = 'src/main/java/module-info.java'
52+
destinationDir = compileJava.destinationDir
53+
54+
doFirst {
55+
options.compilerArgs = [
56+
'--release', '9',
57+
'--module-path', compileJava.classpath.asPath,
58+
]
59+
}
5660
}
5761

62+
compileModuleInfoJava.dependsOn compileJava
63+
classes.dependsOn compileModuleInfoJava
64+
65+
// End of Java 9 compatibility config
66+
67+
5868
task javadocJar(type: Jar, dependsOn: javadoc) {
5969
classifier = 'javadoc'
6070
from javadoc.destinationDir
@@ -65,7 +75,6 @@ task sourcesJar(type: Jar, dependsOn: classes) {
6575
from sourceSets.main.allSource
6676
}
6777

68-
6978
//
7079
// Separate unit tests from integration tests. See: `src/test-integration/README.md`
7180
//

gradle/wrapper/gradle-wrapper.jar

1.44 KB
Binary file not shown.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Tue Oct 24 14:22:43 EDT 2017
1+
#Tue Jun 18 14:17:49 EDT 2019
22
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-4.10.2-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

src/test-integration/java/com/bettercloud/vault/util/VaultContainer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class VaultContainer implements TestRule, TestConstants {
3838
* Establishes a running Docker container, hosting a Vault server instance.
3939
*/
4040
public VaultContainer() {
41-
container = new GenericContainer("vault:1.0.2")
41+
container = new GenericContainer("vault:1.1.3")
4242
.withClasspathResourceMapping("/startup.sh", CONTAINER_STARTUP_SCRIPT, BindMode.READ_ONLY)
4343
.withClasspathResourceMapping("/config.json", CONTAINER_CONFIG_FILE, BindMode.READ_ONLY)
4444
.withClasspathResourceMapping("/libressl.conf", CONTAINER_OPENSSL_CONFIG_FILE, BindMode.READ_ONLY)

0 commit comments

Comments
 (0)