Quarkus: Uberjar does not include add dependencies

Created on 4 May 2020  路  7Comments  路  Source: quarkusio/quarkus

Describe the bug
This is a project created from code.quarkus.io and configured to generate a uber jar and to use com.google.common.base.Strings class.
It will work if ran from maven (./mvn quarkus:dev), but not from the uber jar (java -jar ...) due to a missing dependency (the above mentioned class)

Expected behavior
Both should run.

Actual behavior
Only the maven version runs, because the development version seems to get this class from the dependency quarkus-ide-launcher-1.4.1.Final.jar.
It can be even worse, is case the version executed in dev is different than the one executed on the environment.

To Reproduce
Steps to reproduce the behavior:

  1. Checkout the project
  2. Run with maven -> calling http://localhost:8080/hello works
  3. Generate the uber jar (or use the one I added to the projecT)
  4. See that you cannot call
arebootstrap kinbug

Most helpful comment

Ideally, it should simply fail to build. And even compile. The IDE should be highlighting this as a missing dependency. I think we should review our IDE launcher implementation to avoid this kind of issues. It enables not only guava but all sorts of other dependencies during development that won't be there at runtime.

All 7 comments

I don't think this is a bug TBH. You haven't added Guava to your pom.xml, so it most certainly does not end up in the built jar.

@geoand I agree, but then it should fail in the dev mode, right? My problem is not that it does not work, my problem is that the behavior is different depending how I start it up,

Right, ideally it should. Problem is that devmode has some dependencies of it's own that are being picked up in this case.

cc @stuartwdouglas @aloubyansky

@oscarfh Thank you for volunteeting. The best person to help you out and / or coordinate efforts is @aloubyansky who has steadily been improving our Gradle support with difficult to make fixes.

Ideally, it should simply fail to build. And even compile. The IDE should be highlighting this as a missing dependency. I think we should review our IDE launcher implementation to avoid this kind of issues. It enables not only guava but all sorts of other dependencies during development that won't be there at runtime.

The only real option here would be to shade all the IDE launcher dependencies, although we will need to be careful about which ones to shade.

+1 for shading to avoid such issues

Was this page helpful?
0 / 5 - 0 ratings