0

From

I am trying to clean up a messy Gradle-based monorepo while upgrading from Java 8 to Java 11/17. I am not a Jandex or Helidon expert, but I am slowly getting more expert with Gradle. I am wondering if Bazel would be a better solution. , but I digress...

Along the way, many things broke, and my general approach has been upgrading version of tools that hopefully work better with Java 11. However, this is not always an effective strategy.

We use Helidon 2.x for several projects, but I have run into trouble with Jandex, and I really don't understand Jandex as the documentation is weak on context. ChatGPT gave me a better explanation of Jandex than the Jandex documentation, but I can only go so far.

I tried upgrading to Helidon 3.x, but too many things broke. It appears that Jandex wants org.jboss:jandex:2.3.1.Final (c), but I am wondering if there is any way to make it work with io.smallrye:jandex:3.0.5 or io.jboss:jandex:3.0.5 just so I can have the latest version of things? Right now, I am trying to figure out the best version of the Gradle Jandex Pluging to use, as 1.1.0 does not seem to work.

I tried to force this with https://docs.gradle.org/current/userguide/dependency_constraints.html but could not get it working.

The people on the https://github.com/smallrye/jandex issues have been enormously helpful and prompt, but have suggested this is a better forum for getting help with my issues.

Finally, can anyone point me to some more comprehensive documentation on Jandex and how it works?

Eric Kolotyluk
  • 1,958
  • 2
  • 21
  • 30
  • 1
    If Helidon requires Jandex 2.3 and you generate a Jandex index using Jandex 3.0, that won't work. Jandex index format is backward compatible, but not forward compatible (see the compatibility promise at https://smallrye.io/jandex/). Just generate an index using Jandex 2.3.1, which the Jandex Gradle plugin 0.x should easily allow. Aside, it is true there's little "conceptual" documentation for Jandex, but it is overall expected that application developers don't need to know anything about it. Even in this case, you don't have a Jandex problem -- you have a dependency convergence problem. – Ladicek Mar 16 '23 at 16:43
  • There are several Gradle 0.x plugins. Can you recommend a specific one, or should I just use trial and error until I find the latest one that works? Also, in this context, I am not the application developer, I am working in the role of build engineer, although I am doing my best to think more like the application developers who built this. Agreed, in trying to upgrade to Java 11+, I have created a dependency convergence problem. – Eric Kolotyluk Mar 16 '23 at 18:04
  • Helidon 2.x itself appears to standardize on the `org.jboss.jandex:jandex-maven-plugin:1.1.0` artifact. Since presumably that generates indices that SmallRye's OpenAPI project version 2.0.26 can read, then perhaps it will do fine for you as well. See https://github.com/helidon-io/helidon/blob/helidon-2.x/pom.xml#L456-L460. – Laird Nelson Mar 16 '23 at 21:14
  • 1
    (My mistake; I forgot you are a Gradle user. I don't know Gradle so cannot comment on which plugin you should use.) – Laird Nelson Mar 16 '23 at 21:26
  • 1
    I meant the `kordamp` Jandex Gradle plugin, which seems to be the most commonly used one. – Ladicek Mar 16 '23 at 23:01
  • Yes, we are using kordamp jandex plugin. – Eric Kolotyluk Mar 17 '23 at 15:27

1 Answers1

1

To answer the question as asked:

No, you cannot get Helidon 2.x to use Jandex 3.x. Among other things, this is because (as previously explained) the version of SmallRye's OpenAPI project (which is actually the thing that uses Jandex, so Helidon is basically irrelevant here) that is used by Helidon 2.x requires the API published by Jandex 2.x.

To answer a rephrasing of the question:

"Can I get SmallRye's OpenAPI project version 2.0.26, whether it is used by Helidon or not, to use Jandex 3.x?"

No, you cannot get SmallRye's OpenAPI project version 2.0.26 to use Jandex 3.x. Among other things, this is because (as previously explained) the API exposed by Jandex 2.x is different from the API exposed by Jandex 3.x (which is almost certainly why the major version number increased).

Laird Nelson
  • 15,321
  • 19
  • 73
  • 127
  • So, through trial and error, I was able to back out of my Version 11 problem by progressively downgrading the jandex plugin until I reached 0.8.0. I am still having jandex issues, but they are beyond the scope of this topic. – Eric Kolotyluk Mar 17 '23 at 15:27
  • I don't know Gradle at all, but another way you could have done this was to go to the source and figure out what version of Jandex the plugin is using and when it changed: https://github.com/kordamp/jandex-gradle-plugin/blame/master/gradle.properties#L23 – Laird Nelson Mar 17 '23 at 16:44