quarkus: @Produce(EmptyBuildItem.class) not working

Describe the bug

As suggested in a comment, when a build step is not producing any build item, we can annotate with @Produce(EmptyBuildItem.class) and the build step is going to be invoked always. See line https://github.com/quarkusio/quarkus/blob/2a41f877abb93112b5bd58d56165c2c06e64aa3a/core/builder/src/main/java/io/quarkus/builder/BuildStepBuilder.java#L204.

However, this is not working for me. See reproducer.

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

  1. git clone https://github.com/quarkiverse/quarkus-helm
  2. cd quarkus-helm
  3. git branch avoid_both_extensions
  4. mvn clean install

The build fails because the resources are not generated (if @Produce(EmptyBuildItem.class) would work, the resources would be generated (see main branch).

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 36 (36 by maintainers)

Commits related to this issue

Most upvoted comments

But since it exists and we’re relying on it… OK with that I guess, but let’s try to phase it out?

It does not exist yet 😉. Some code relies on it but it simply does not work.

I could not find any workaround to my issue. Previously, I was producing a FeatureBuildItem item and everything worked fine until I started using the OpenShift Container Image extension that needs a JAR build item. Here is where the build chain got crazy and I’m sure the issue is related to how the Kubernetes/OpenShift extensions are written.

Well, that’s something that needs to be investigated IMO…

So, my only hope was to somehow run my build step after the build is finished.

I don’t think that it’s possible.

I think it does make sense to create such a build item given some people were expecting it to work anyway.

As for the name, I think I would prefer AlwaysConsumedBuildItem.

This is actually a very good argument because EmptyBuildItem does not indicate “when” the build step will be executed. It should be probably a final item that will be consumable after the build step chain completes.

That raises an interesting question: do we really want the build step marked with @Produce(AlwaysConsumedBuildItem.class) to always be executed? E.g. I know we somehow consume a particular build item when generating dev services configuration; surely we don’t want to execute the build step then?

Maybe the name should be something like ExtensionCompleteBuildItem, to convey the meaning “the extension can only be considered complete once all those build items have been produced”? Then it would make sense to execute various checks in build steps that produce that build item.


I’m volunteering in working on this, just let me know if I should proceed

Gladly, thanks 😃

any hints are welcome 😃

You will have to: