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

Scala Steward can not run on this repo until it allows building under Java 21 #327

Open
rtyley opened this issue Apr 24, 2024 · 3 comments

Comments

@rtyley
Copy link
Member

rtyley commented Apr 24, 2024

See guardian/scala-steward-public-repos#67 ... we're now running our Scala Steward workflow with Java 21 LTS, which means that all projects that want to have Scala Steward updates (like this one) need to be able to build under Java 21 (even if the projects are still running in production on Java 8).

An example of Scala Steward failing when trying to handle this repo is here:

https://github.com/guardian/scala-steward-public-repos/actions/runs/8814650168/job/24194965264#step:6:1970

[info] [launcher] getting org.scala-sbt sbt 1.5.8 (this may take some time)...
[info] [launcher] getting Scala 2.12.14 (for sbt)...
java.lang.ClassCastException: class java.lang.UnsupportedOperationException cannot be cast to class xsbti.FullReload (java.lang.UnsupportedOperationException is in module java.base of loader 'bootstrap'; xsbti.FullReload is in unnamed module of loader 'app')

Unfortunately the Scala Steward run failing affects everyone, see guardian/scala-steward-public-repos#60 - so I've removed this repo from Scala Steward until this issue is fixed.

How to fix this issue?

For the buid to run under Java 21, a few things are easy, but some are a bit more involved:

  • Easy: Update Scala (2.12.18+) & sbt (1.9.0+)
  • Hard: Cope with updates to JAXB that come with Java 9 and above - the JAXB library is no longer a core part of Java, and the sbt-cxf plugin has not been updated in a long time and isn't compiled for that change. I think the best bet here may be to move to using scalaxb, which is maintained and can probably provide the WSDL/XML parsing that is required - it could be tricky though, let me know if you'd like to pair on it.

cc @LAKSHMIRPILLAI @tomrf1

@tomrf1
Copy link
Member

tomrf1 commented Apr 24, 2024

Thanks @rtyley , we did briefly look at upgrading java but parked it, so your advice regarding jaxb is really helpful!

@rtyley
Copy link
Member Author

rtyley commented Apr 24, 2024

Ah, I've taken a look at this, and think I can help- alright if I raise a PR?

@tomrf1
Copy link
Member

tomrf1 commented Apr 24, 2024

of course! We have a health ticket for it but you're more than welcome to contribute :)

rtyley added a commit that referenced this issue Apr 24, 2024
As noted in #327,
it looks like`salesforce-message-handler` needs to drop sbt-cxf to work with
versions of Java newer than Java 8 (the JAXB library is no longer a core part
of Java).

`scalaxb` (https://github.com/eed3si9n/scalaxb) looks like a good replacement
for `sbt-cxf`/[`wsdl2java`](https://cxf.apache.org/docs/wsdl-to-java.html),
it's maintained and has Scala-specific support:

https://index.scala-lang.org/eed3si9n/scalaxb/artifacts/scalaxb

The generated classes created by `scalaxb` are pretty similar to the ones
generated by `wsdl2java`, there was just a small wrinkle with
nillable id fields, which was not too hard to cope with.
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

No branches or pull requests

2 participants