Hey :wave: First of all thanks for contributing to...
# help
a
Hey 👋 First of all thanks for contributing to this library. I’ve been using for ages now with ❤️ Apologies if this has been answered already, but I could not find the relevant issue/thread neither here nor on Github. For my company I usually maintain a project that uses
wiremock-jre8
for integration tests. I’d like to migrate to
wiremock
3.x without losing the ability to release jars which can run on Java8 (We’d also love to drop 1.8 support, but we can’t because some of our customers are still on 1.8). Is this possible ? I wonder if I can achieve that with the help of task-specific toolchains. Thank you!
o
Hello Andrea. You can build and test Java 8 targeted product binaries with JDK 11. What you cannot do is running tests on Java 8 if you use WireMock 3 directly
You can also consider using https://github.com/wiremock/wiremock-testcontainers-java which is compatible with Java 8 and runs WireMock in a container with its own Java
a
Thanks. The
toolchains
directive was causing some extra headaches. I’ve replaced that with:
Copy code
compileJava {
    sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_1_8
}
It looks good 👍 Out of curiosity, is there any reason why you would suggest switching to testcontainers as opposed to the above approach ? On this project I’d anyway need to target version 1.8 (either with
toolchains
or
targetCompatibility
)… So I don’t really care about the extra
build.gradle
config
o
What you do is basically cross compilation on Java. It normally works well for the production code itself, but later you might get into issues with developer tools like static analyzers. Not all tools work for this mode well, e.g. code mocking or Spotbugs bytecode analysis as I learned the hard way when working on Java 11 support in Jenkins
🙌 1
👍 1
On the other hand it was quite a while ago, and now the tooling improved. So hopefully the mileage will vary in 2023
🤞 1
a
Yeah.. I’ll go with the cross-compilation approach for now as I currently don’t see issues with our pipeline for tests and code quality. I’ll pin this as an option if things change in future. Thank you!