9

Based on the following maven configuration from this SO question, answered for Maven builds, I need an equivalent bit of code for a Gradle setup. Looking around, I can't find a setup that does this for Gradle.

Synopsis of issue from other question: Essentially that classes from external projects aren't indexed so that Quarkus can use them. The solution below rebuilds the index and allows access to the classes.

Code from other question:

<build>
  <plugins>
    <plugin>
      <groupId>org.jboss.jandex</groupId>
      <artifactId>jandex-maven-plugin</artifactId>
      <version>1.0.6</version>
      <executions>
        <execution>
          <id>make-index</id>
          <goals>
            <goal>jandex</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

Also... after more digging, it appears that there might already be a fix in the works here (github merge request. At time of writing, this is merged but doesn't look like it is part of a release. Will follow up if this changes, and if it fixes ths issue.

Update:

With the release of 0.18.0, I am still having issues, but I believe I am closer. I still get the following (very similar) error:

2019-06-27 19:45:52,741 INFO  [io.qua.dep.QuarkusAugmentor] (main) Beginning quarkus augmentation
2019-06-27 19:45:53,241 WARN  [io.qua.dep.ste.ReflectiveHierarchyStep] (build-8) Unable to properly register the hierarchy of the following classes for reflection as they are not in the Jandex index:
- com.ebp.reasonadle.shared.pojos.user.User
Consider adding them to the index either by creating a Jandex index for your dependency via the Maven plugin, an empty META-INF/beans.xml or quarkus.index-dependency properties.");.

This is with the empty beans.xml, and at this point I am unsure how to attempt the entries in application.properties.

Entries suggested in other question:

quarkus.index-dependency.<name>.group-id=
quarkus.index-dependency.<name>.artifact-id=
quarkus.index-dependency.<name>.classifier=(this one is optional)

I am confused as for what the placeholder <name> is supposed to be. Classname? Gradle project name? Also I assume the empty assignments are intentional?

The structure of my overall gradle project:

| Main
| \ (API folder)
|  | User API (Quarkus Project, pulls in pojos)
| \ (Common resource folder)
|  | Common pojo's (Java library, done with Gradle's plugin)

For the Quarkus devs viewing this, I would argue that this shouldn't be necessary. Sharing pojos between projects is quite common, and what I would call good design. Maybe a quickstart is in order for explaining how to make this work?

Snappawapa
  • 1,697
  • 3
  • 20
  • 42
  • I don't think there's a Gradle plugin for Jandex. The 2 other options from the answer you link should still be possible (adding `beans.xml` or adding `quarkus.index-dependency.*` to `application.properties`). EDIT: it seems I was wrong, there seems to be a Gradle plugin for Jandex here: https://github.com/galaxx-org/org.galaxx.gradle – Ladicek Jun 27 '19 at 06:08
  • @Ladicek perhaps you should convert your comment into an answer? – geoand Jun 27 '19 at 14:43
  • @Ladicek Unfortunately, I could not get it to work with the other two fixes (`beans.xml` or entries in `application.properties`), hence my continued issues. I have also seen that plugin, but it looks like a dead project, as there haven't been any commits since 2016. Even after trying the galaxx plugin, still hitting the same issue anyways. – Snappawapa Jun 27 '19 at 19:08
  • 1
    @Snappawapa: Did you ever find a solution to this? I have the same problem and opened an issue for Quarkus here: https://github.com/quarkusio/quarkus/issues/6635 – andy Jan 21 '20 at 13:06
  • @andy I have not, sadly. Since then I have moved to Jackson based serialization to handle all that – Snappawapa Jan 21 '20 at 13:11
  • @andy I am back into being stuck with this problem.... turns out even with jackson, it still wants the index.... pain in the butt for sure, and no solution yet – Snappawapa Jan 25 '20 at 01:03
  • Maybe try to reach out to the devs on their Zulip chat (https://quarkusio.zulipchat.com). Sometimes they are very responsive. – andy Jan 27 '20 at 12:23
  • @Snappawapa did you find a solution meanwhile? I'm facing the same issue with a Gradle multi-module project where the Jandex.idx files inside my shared libraries are not detected. – Marc-Christian Schulze Mar 14 '20 at 12:15
  • Still nothing sadly :( – Snappawapa Mar 17 '20 at 12:52
  • is this still a problem after https://github.com/quarkusio/quarkus/issues/6635 got solved? use quarkus 1.3+ to try out. – Max Rydahl Andersen Apr 27 '20 at 11:32

1 Answers1

0

This was eventually solved by https://github.com/quarkusio/quarkus/issues/6635

There was a relapse in 1.5.0, but it was quickly resolved.

For me, it doesn't seem like I needed anything extra in the META-INF folder or manual/ explicit indexing of other submodules.

Snappawapa
  • 1,697
  • 3
  • 20
  • 42