Skip to content

Commit 451c8d4

Browse files
authored
Clean build on all available JDK versions (#729)
- POM and JavaDoc updates to get a clean (warning free) build, remove duplicates, etc - Ensured CI uses the release build profile (i.e. 'ossrh') to ensure we can execute all things necessary for a release. This will not deploy to ossrh however, as we do that manually during a release per https://github.com/jwtk/jjwt/wiki#release-instructions - Fixing JavaDoc lint errors surfacing on JDK 14 - Enable html5 for JavaDoc on JDK >= 9 - Used version properties and Maven profiles to allow the japicmp-maven-plugin to work with JDK 7 through 18 - Minor CI job name fixes, added additional zulu JDK versions - Fixed build to run on all JDKs, from 7 to 18 inclusive
1 parent b784732 commit 451c8d4

23 files changed

Lines changed: 349 additions & 363 deletions

.github/workflows/ci.yml

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,27 @@ on:
77
- master
88

99
jobs:
10-
hotspot:
10+
temurin:
1111
strategy:
1212
matrix:
13-
java: [ '8', '11' ]
13+
java: [ '8', '11', '17', '18' ]
1414
runs-on: 'ubuntu-latest'
1515
env:
1616
MVN_CMD: ./mvnw --no-transfer-progress -B
17-
name: java-${{ matrix.java }}
17+
name: jdk-${{ matrix.java }}-temurin
1818
steps:
19-
- uses: actions/checkout@v2.4.0
19+
- uses: actions/checkout@v3
2020
- name: Set up JDK
21-
uses: actions/setup-java@v2.4.0
21+
uses: actions/setup-java@v3
2222
with:
2323
java-version: ${{ matrix.java }}
2424
distribution: 'temurin'
2525
cache: 'maven'
26+
check-latest: true
2627
- name: Build
27-
run: ${{env.MVN_CMD}} verify
28+
# run a full build, just as we would for a release (i.e. the `ossrh` profile), but don't use gpg
29+
# to sign artifacts, since we don't want to mess with storing signing credentials in CI:
30+
run: ${{env.MVN_CMD}} verify -Possrh -Dgpg.skip=true
2831
- name: Code coverage
2932
if: matrix.java == '8'
3033
run: |
@@ -37,34 +40,40 @@ jobs:
3740
zulu:
3841
strategy:
3942
matrix:
40-
java: [ '9', '10', '14' ]
43+
java: [ '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18' ]
4144
runs-on: 'ubuntu-latest'
4245
env:
4346
MVN_CMD: ./mvnw --no-transfer-progress -B
44-
name: java-${{ matrix.java }}
47+
JDK_MAJOR_VERSION: ${{ matrix.java }}
48+
name: jdk-${{ matrix.java }}-zulu
4549
steps:
46-
- uses: actions/checkout@v2.4.0
50+
- uses: actions/checkout@v3
4751
- name: Set up JDK
48-
uses: actions/setup-java@v2.4.0
52+
uses: actions/setup-java@v3
4953
with:
5054
java-version: ${{ matrix.java }}
5155
distribution: 'zulu'
5256
cache: 'maven'
57+
check-latest: true
5358
- name: Build
54-
run: ${{env.MVN_CMD}} verify
59+
# run a full build, just as we would for a release (i.e. the `ossrh` profile), but don't use gpg
60+
# to sign artifacts, since we don't want to mess with storing signing credentials in CI:
61+
run: |
62+
if [ "$JDK_MAJOR_VERSION" == "7" ]; then export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=128m"; fi
63+
${{env.MVN_CMD}} verify -Possrh -Dgpg.skip=true
5564
56-
java-7:
65+
jdk-7-oracle:
5766
runs-on: 'ubuntu-latest'
5867
env:
5968
MVN_CMD: ./mvnw --no-transfer-progress -B
6069
MAVEN_OPTS: "-Dhttps.protocols=TLSv1.2 -Xmx512m -XX:MaxPermSize=128m"
6170
steps:
62-
- uses: actions/checkout@v2.4.0
71+
- uses: actions/checkout@v3
6372
- run: |
6473
download_url="https://238dj3282as03k369.s3-us-west-1.amazonaws.com/jdk-7u80-linux-x64.tar.gz"
6574
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
6675
- name: Set up JDK
67-
uses: actions/setup-java@v2.4.0
76+
uses: actions/setup-java@v3
6877
with:
6978
distribution: 'jdkfile'
7079
jdkFile: ${{ runner.temp }}/java_package.tar.gz
@@ -77,4 +86,6 @@ jobs:
7786
unzip -oj -d "$JAVA_HOME/jre/lib/security" $RUNNER_TEMP/UnlimitedJCEPolicyJDK7.zip \*/\*.jar
7887
rm $RUNNER_TEMP/UnlimitedJCEPolicyJDK7.zip
7988
- name: Build
80-
run: ${{env.MVN_CMD}} verify
89+
# run a full build, just as we would for a release (i.e. the `ossrh` profile), but don't use gpg
90+
# to sign artifacts, since we don't want to mess with storing signing credentials in CI:
91+
run: ${{env.MVN_CMD}} verify -Possrh -Dgpg.skip=true

api/src/main/java/io/jsonwebtoken/Claims.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* claims.{@link Map#put(Object, Object) put}("someKey", "someValue");
3232
* </pre>
3333
*
34-
* <h3>Creation</h3>
34+
* <h2>Creation</h2>
3535
*
3636
* <p>It is easiest to create a {@code Claims} instance by calling one of the
3737
* {@link Jwts#claims() JWTs.claims()} factory methods.</p>
@@ -177,7 +177,7 @@ public interface Claims extends Map<String, Object>, ClaimsMutator<Claims> {
177177
* complex is expected to be already converted to your desired type by the JSON
178178
* {@link io.jsonwebtoken.io.Deserializer Deserializer} implementation. You may specify a custom Deserializer for a
179179
* JwtParser with the desired conversion configuration via the {@link JwtParserBuilder#deserializeJsonWith} method.
180-
* See <a href="https://github.com/jwtk/jjwt#custom-json-processor">custom JSON processor</a></a> for more
180+
* See <a href="https://github.com/jwtk/jjwt#custom-json-processor">custom JSON processor</a> for more
181181
* information. If using Jackson, you can specify custom claim POJO types as described in
182182
* <a href="https://github.com/jwtk/jjwt#json-jackson-custom-types">custom claim types</a>.
183183
*

api/src/main/java/io/jsonwebtoken/CompressionCodecs.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,19 @@ private CompressionCodecs() {
3434
* <a href="https://en.wikipedia.org/wiki/DEFLATE">deflate</a> compression algorithm
3535
*/
3636
public static final CompressionCodec DEFLATE =
37-
Classes.newInstance("io.jsonwebtoken.impl.compression.DeflateCompressionCodec");
37+
Classes.newInstance("io.jsonwebtoken.impl.compression.DeflateCompressionCodec");
3838

3939
/**
4040
* Codec implementing the <a href="https://en.wikipedia.org/wiki/Gzip">gzip</a> compression algorithm.
41-
* <h3>Compatibility Warning</h3>
41+
*
42+
* <p><b>Compatibility Warning</b></p>
43+
*
4244
* <p><b>This is not a standard JWA compression algorithm</b>. Be sure to use this only when you are confident
4345
* that all parties accessing the token support the gzip algorithm.</p>
46+
*
4447
* <p>If you're concerned about compatibility, the {@link #DEFLATE DEFLATE} code is JWA standards-compliant.</p>
4548
*/
4649
public static final CompressionCodec GZIP =
47-
Classes.newInstance("io.jsonwebtoken.impl.compression.GzipCompressionCodec");
50+
Classes.newInstance("io.jsonwebtoken.impl.compression.GzipCompressionCodec");
4851

4952
}

api/src/main/java/io/jsonwebtoken/Header.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
* header.{@link Map#put(Object, Object) put}("headerParamName", "headerParamValue");
3131
* </pre>
3232
*
33-
* <h3>Creation</h3>
33+
* <h2>Creation</h2>
3434
*
3535
* <p>It is easiest to create a {@code Header} instance by calling one of the
3636
* {@link Jwts#header() JWTs.header()} factory methods.</p>

api/src/main/java/io/jsonwebtoken/JwtBuilder.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import io.jsonwebtoken.io.Serializer;
2222
import io.jsonwebtoken.security.InvalidKeyException;
2323
import io.jsonwebtoken.security.Keys;
24+
2425
import java.security.Key;
2526
import java.util.Date;
2627
import java.util.Map;
@@ -365,7 +366,7 @@ public interface JwtBuilder extends ClaimsMutator<JwtBuilder> {
365366
/**
366367
* Signs the constructed JWT using the specified algorithm with the specified key, producing a JWS.
367368
*
368-
* <h4>Deprecation Notice: Deprecated as of 0.10.0</h4>
369+
* <p><b>Deprecation Notice: Deprecated as of 0.10.0</b></p>
369370
*
370371
* <p>Use {@link Keys Keys}.{@link Keys#hmacShaKeyFor(byte[]) hmacShaKeyFor(bytes)} to
371372
* obtain the {@code Key} and then invoke {@link #signWith(Key)} or {@link #signWith(Key, SignatureAlgorithm)}.</p>
@@ -390,7 +391,7 @@ public interface JwtBuilder extends ClaimsMutator<JwtBuilder> {
390391
* <p>This is a convenience method: the string argument is first BASE64-decoded to a byte array and this resulting
391392
* byte array is used to invoke {@link #signWith(SignatureAlgorithm, byte[])}.</p>
392393
*
393-
* <h4>Deprecation Notice: Deprecated as of 0.10.0, will be removed in the 1.0 release.</h4>
394+
* <p><b>Deprecation Notice: Deprecated as of 0.10.0, will be removed in the 1.0 release.</b></p>
394395
*
395396
* <p>This method has been deprecated because the {@code key} argument for this method can be confusing: keys for
396397
* cryptographic operations are always binary (byte arrays), and many people were confused as to how bytes were
@@ -410,13 +411,12 @@ public interface JwtBuilder extends ClaimsMutator<JwtBuilder> {
410411
* StackOverflow answer</a> explaining why raw (non-base64-encoded) strings are almost always incorrect for
411412
* signature operations.</p>
412413
*
413-
* <p>To perform the correct logic with base64EncodedSecretKey strings with JJWT >= 0.10.0, you may do this:
414+
* <p>To perform the correct logic with base64EncodedSecretKey strings with JJWT &gt;= 0.10.0, you may do this:</p>
414415
* <pre><code>
415416
* byte[] keyBytes = {@link Decoders Decoders}.{@link Decoders#BASE64 BASE64}.{@link Decoder#decode(Object) decode(base64EncodedSecretKey)};
416417
* Key key = {@link Keys Keys}.{@link Keys#hmacShaKeyFor(byte[]) hmacShaKeyFor(keyBytes)};
417418
* jwtBuilder.signWith(key); //or {@link #signWith(Key, SignatureAlgorithm)}
418419
* </code></pre>
419-
* </p>
420420
*
421421
* <p>This method will be removed in the 1.0 release.</p>
422422
*
@@ -475,7 +475,7 @@ public interface JwtBuilder extends ClaimsMutator<JwtBuilder> {
475475
* can be useful. For example, when embedding JWTs in URLs, some browsers may not support URLs longer than a
476476
* certain length. Using compression can help ensure the compact JWT fits within that length. However, NOTE:</p>
477477
*
478-
* <h3>Compatibility Warning</h3>
478+
* <p><b>Compatibility Warning</b></p>
479479
*
480480
* <p>The JWT family of specifications defines compression only for JWE (Json Web Encryption)
481481
* tokens. Even so, JJWT will also support compression for JWS tokens as well if you choose to use it.

0 commit comments

Comments
 (0)