Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Java 17 #186

Merged
merged 19 commits into from
Mar 7, 2023
Merged

Add support for Java 17 #186

merged 19 commits into from
Mar 7, 2023

Conversation

mstruk
Copy link
Contributor

@mstruk mstruk commented Mar 6, 2023

  • Added three profiles: java-8, java-11, and java-17 that activate automatically based on the JDK used
  • Fixed JavaDoc warnings so the project builds with Java 17
  • Fixed .travis/build.sh script to use Java 11 and run testsuite on x86_64

Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
…ava-11 and java-17

Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
…te on `x86_64`

Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
@mstruk mstruk added this to the 0.12.0 milestone Mar 6, 2023
@mstruk mstruk requested a review from scholzj March 6, 2023 09:25
@@ -18,7 +18,6 @@ jobs:
packages:
- maven
jdk:
- openjdk8
- openjdk11
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you should add Java 17 here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, makes sense.

.travis/build.sh Outdated Show resolved Hide resolved
.travis/build.sh Outdated
if [ ${JAVA_MAJOR_VERSION} -eq 1 ] ; then
# some parts of the workflow should be done only once on the main build which is currently Java 8
if [ "$arch" == 'x86_64' ] || [ "$arch" == 'arm64' ] ; then
# some parts of the workflow should be done only once on the main build which is currently Java 11
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should you check the Java version here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we have multiple java versions enabled as you suggested above then yes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, the question is do we want to run as many of the tests on as many of the platforms as possible.

I'm not sure but IIRC the Arquillian Cube based testsuite only worked on Java 8, that has been fixed by moving to TestContainers.
Another thing I remember is that the testsuite run would take so long or produce so much output that it triggered some limits and was killed by Travis.
I guess we can try again running the full testsuite on both Java 11 and Java 17, and if that will hit limits then I suggest we limit the testsuite to Java 11, that's due to the next paragraph ...

We have to decide which class version libraries we want to push to maven upon release.
I would still prefer Java 8 as that makes the jars most widely usable, but we decided to move on from there. Therefore I suggest Java 11 for the same reason.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think anyone is prescribing what Java versions should Oauth support. We need Java 11 as a minimum. But if you want to support Java 8, then fine. But Java 8 is super old, Kafka will stop supporting it soon etc. So I think it is time to cut it. But even if you want to release with Java 8 as a target version, we need to have testing with Java 11 and Java 17

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I added openjdk8 back to the Travis build, and reworked logic so that testsuite is run for all java versions on all platforms. Only Java 8 build on x86_64 will be published if it's a release build.

…ease 1.8 class version artifacts

Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
…oo long

Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
…e on s390x

Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
…rimzi kafka images for this platform on quay.io

Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
.travis/build.sh Outdated
@@ -18,70 +18,58 @@ exitIfError() {
[ "$EXIT" != "0" ] && exit $EXIT
}

arch=$(uname -m)
echo "arch: $arch"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to keep this, maybe it can be a bit nicer? Architecture: ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, let's have the printout to be sure that the actual architecture label is not something different then I'm expecting.
I can make it a bit nicer :)

pom.xml Outdated
Comment on lines 346 to 377
<profile>
<id>java-8</id>
<activation>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</profile>
<profile>
<id>java-11</id>
<activation>
<jdk>[11,17)</jdk>
</activation>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.release>11</maven.compiler.release>
</properties>
</profile>
<profile>
<id>java-17</id>
<activation>
<jdk>[17,</jdk>
</activation>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.release>17</maven.compiler.release>
</properties>
</profile>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both here and in the other pom.xml ... Do we really need the profiles here? The main point of these Java 11 and Java 17 builds is to ensure that it works in the environments using Java 11 and Java 17. So I do not think we need to change the source / target versions as we want it to be as close as possible to the code you will actually release.

I do not think we did anything like this on the other Strimzi projects either.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found that maven.compiler.release option was necessary to build with Java 11 or 17. Without it I was getting an error like: system modules path not set in conjunction with -source

However, Java-8 build would not build if this option was present.

It could be the specifics of my local environment, but I just did whatever was necessary to get things to work.

The other thing there is the compiler source 11 in java-17 profile. This one I kind of forgot in there.
I'll set it to 17 so it's in sync with the others.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what maven.compiler.release does TBH. But maybe we can at least keep the source and target?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean ideally, we would want to have a single build and then test the binaries it produces with the different JDKs. But that would be quite complicated. But I think it would be great to get at least close to it.

Copy link
Contributor Author

@mstruk mstruk Mar 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case I would most prefer1.8. We could remove java-8 profile, and remove source and target overrides from java-11 and java-17 profiles, but they would still need the release set to 8.
Would that be better?

…x from testsuite build - hostname aliases not working

Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
…vity on s390x

Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
…jdks

Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
@mstruk
Copy link
Contributor Author

mstruk commented Mar 7, 2023

I modified the profiles and versions in pom.xml as described above, and fixed hostname aliases as .travis/build.sh so that a full testsuite run is passing on all java versions on amd64, and on the configured Java 11 version on s390x, where as the testsuite run is skipped on ppc64le due to unavailable docker images for that platform.

Copy link
Member

@scholzj scholzj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left two nits / questions. But if you think it is needed as it s, then its fine with me.

Comment on lines 402 to 433
<profile>
<id>java-8</id>
<activation>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</profile>
<profile>
<id>java-11</id>
<activation>
<jdk>[11,17)</jdk>
</activation>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.release>11</maven.compiler.release>
</properties>
</profile>
<profile>
<id>java-17</id>
<activation>
<jdk>[17,</jdk>
</activation>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.release>17</maven.compiler.release>
</properties>
</profile>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this use the same profile as the main pom.xml? Or is there some reason to have it different?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, missed that. Good catch.

pom.xml Show resolved Hide resolved
Signed-off-by: Marko Strukelj <marko.strukelj@gmail.com>
@mstruk mstruk merged commit 6f997c1 into strimzi:main Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants