quarkus-scala3
quarkus-scala3 copied to clipboard
Improve extension metadata
The extension metadata in https://github.com/quarkiverse/quarkus-scala3/blob/main/runtime/src/main/resources/META-INF/quarkus-extension.yaml needs to be improved with the extension description and keywords.
This is necessary to be correctly listed in registry.quarkus.io and code.quarkus.io
I'm at a bit of a crossroads with how to handle this unfortunately
One of the issues is that if you were to just install the extension, it won't work out of the box.
This is because Quarkus has a version of Scala 2 transitively in core quarkus-bom deps:
https://github.com/quarkusio/quarkus/blob/e362feb55cae3f05da5de9fb888500258f40953c/bom/application/pom.xml#L139-L140
<!-- Scala is used by Kafka so we need to choose a compatible version -->
<scala.version>2.12.13</scala.version>
Scala 3 needs Scala 2 as well -- but EXACTLY the version it was compiled with. For example:
- https://mvnrepository.com/artifact/org.scala-lang/scala3-library_3/3.1.0

If you want to use Scala 3.1.0, you need to make sure that exactly (and only) scala-library:2.13.6 is on your classpath.
For some odd reason, the resolution algorithm doesn't work right in Maven, and requires manual fixing. I assume it may be the same in Gradle so recommend doing it there just in case:
https://github.com/quarkiverse/quarkus-scala3#maven
How about generating a BOM containing the recommended scala-library and scala3-library versions and have it added before the quarkus-bom?
Ultimately I think we could also consider
- moving the quarkus-scala extension in core to here or;
- remove the quarkus-scala from core completely (using the Maven relocation mechanism - not sure how would that impact the Kafka integration) and let our users know that Scala 3 (this extension) is the only supported version onwards.
Thoughts?
/cc @quarkiverse/quarkiverse-owners
IIUC, Scala 2 and Scala 3 can't be sharing a single BOM, in which case we should move quarkus-scala out of core and let users choose a specific version from the Quarkiverse.
Is there a Scala 2 specific Kafka integration? Or what is the issue?
How about generating a BOM containing the recommended scala-library and scala3-library versions and have it added before the quarkus-bom?
I am happy to do this if someone can point me to directions. Will also need to figure out how to configure the same thing in Gradle but that should be minor (AFAIK there's nothing you can configure in Maven that Gradle doesn't support, right?)
@aloubyansky Is right -- you must choose between:
- Scala 2 (compiler)
- Scala 3 (compiler)
In one set of dependencies.
Now here is the problem visualized:
Scala 3 uses the standard library of Scala 2 (but not the compiler), in addition to scala3-library3 (Scala 3's additions to the base Scala 2 library).
scala-library:vX.X.X scala3-library3 (version irrelevant)
\ /
Scala 3
If there is resolved a different version of scala-library than what the scala3-compiler uses in its pom.xml, it breaks Scala 3.
Here is what is happening by default if you just install the Quarkus plugin and don't override the Scala 2 Library version to manually match Scala 3 Compiler's requirement:
scala-library:v[WRONG] scala3_library3 (version irrelevant)
/ \ /
Kafka --- Scala 2 Scala 3
You would think that the version of scala-library specified by the Scala 3 compiler transitively would be used:
Transitive deps: scala3-compiler_3 -> scala3-library_3 -> scala-library
We can see here scala3-compiler_3:3.1.0 -> scala3-library3:3.1.0 (below) -> scala-library:2.13.6
But for some reason, Maven doesn't use it! It uses Quarkus BOM's version!
Quite a pickle 🤔
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.scala-lang</groupId>
<artifactId>scala3-library_3</artifactId>
<packaging>jar</packaging>
<description>scala3-library</description>
<url>https://github.com/lampepfl/dotty</url>
<version>3.1.0</version>
<name>scala3-library</name>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.13.6</version>
</dependency>
</dependencies>
</project>
That's what BOMs are for - to have control over transitive dependencies (besides direct dependencies w/o explicitly configured versions).
It sounds like the solution is a BOM, then! 😅
I am not very familiar with this so I may need a bit of handholding/reference material to do it properly.
But for some reason, Maven doesn't use it! It uses Quarkus BOM's version!
That's part of the Maven transitive dependency resolution algorithm.
So if you have a BOM with the required dependencies declared before the quarkus-bom, it will take precedence over the dependencies declared in quarkus-bom
Could the solution potentially be to set the Scala 2 Version in Quarkus Kafka and Quarkus Scala 2's pom.xml?
Or do I make a new BOM.xml for this project
EDIT: I should probably update the README now and say "It wasn't a resolution algorithm failure -- Problem Existed Between Keyboard-and-Chair" 😅