quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.54k stars 2.61k forks source link

Unclear if dependencies are included #23015

Open pilhuhn opened 2 years ago

pilhuhn commented 2 years ago

Describe the bug

I was looking for Drools CEP on Quarkus and typed in 'drools' in the filter field, which resulted in 5 hits. I selected CEP. Now the others did not get marked and it is/was unclear to me if dependencies are automatically added or not.

Expected behavior

Needed dependencies are either automatically selected. Or some help text says that they will magically appear in the pom.

Actual behavior

User feels unsure what will happen.

Screenshots

Bildschirmfoto 2022-01-19 um 11 16 31

Environment (please complete the following information):

Additional context (Add any other context about the problem here.)

pilhuhn commented 2 years ago

So apparently only selecting that one item, is not enough and the 1st in the list would need to be added. This is not clear to a user.

After adding

    <dependency>
      <groupId>org.kie.kogito</groupId>
      <artifactId>kogito-quarkus</artifactId>
    </dependency>

The startup complains

Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step org.kie.kogito.quarkus.common.deployment.KogitoAssetsProcessor#generateModel threw an exception: org.kie.kogito.quarkus.common.deployment.MissingRestCapabilityException: No REST capability detected! 
Add the RestEasy (quarkus-resteasy) and RestEasy Jackson (quarkus-resteasy-jackson) extensions if you want Kogito to generate REST endpoints automatically. 
RestEasy Reactive extension is currently not supported: see https://issues.redhat.com/browse/KOGITO-6131 
You may also disable automated REST generation by setting `kogito.generate.rest = false`. 
You may also override this notice by setting `kogito.generate.rest = true` 

Which means that those 2 dependencies should be added by default as well.

maxandersen commented 2 years ago

yeah, in this case we should be able to add required ones if user haven't selected them.

I'm going to move this to quarkus as same happens with mvn/gradle/quarkus cli.

@aloubyansky this feels like something we could handle at code gen and add missing required extensions ?

aloubyansky commented 2 years ago

I am not yet familiar with these kind of dependencies. What requires what in this case? And how are these dependencies resolved/satisfied? I assume they are not regular Maven artifact dependencies.

pilhuhn commented 2 years ago

No, not mvn deps - they would get pulled in and all is good. Here those are more logical ones. If I only select the one I had in the screenshot, the kogito-main one + resteasy + resteasy-jackson should also be added to the generated pom (from code.quarkus.io).

Theoretically, the -addon could include those in its dependencies, but then it is probably harder to get rid of them if they are not needed (like when setting kogito.generate.rest = false )

maxandersen commented 2 years ago

I read it as these are using json features and thus we could deduce it needs one or in case of reactive not to be added ...but don't know if the right metadata/limits are used ?

aloubyansky commented 2 years ago

This sounds like a case for capability requirements. Which we haven't yet implemented, although I did think it would be a matter of time when we get a request for them. It will also mean more UI work for code.quarkus - highlighting or pre-selecting (in case the requirements aren't ambiguous) additional extension requirements for the already selected extensions by the user.

aloubyansky commented 2 years ago

BTW, resteasy-jackson already depends on resteasy, so simply resteasy-jackson will be enough in your case.

maxandersen commented 2 years ago

I don't think we need code quarkus work initially. If we just start by having it add recommended default deps and throw error when the combinations are bad. We can start doing this at command level - not require ui work upfront.

aloubyansky commented 2 years ago

I think it's more complicated than that. If there are alternatives to defaults, we'll have to be detecting that in case the user selects those alternatives and not automatically select the defaults that could conflict with the selected alternatives.

alexforte commented 2 years ago

Hello guys, i always experiment No REST capability detected! Also if added deps in pom.xml There is a workaround?

kstan79 commented 1 year ago

tried, me too. no matter use cli or download .zip from code generator

tpodg commented 6 months ago

Would it be possible to support Kotlin serialization too? Currently it looks like only Jackson is supported, if anything else is used for json serialisation, the same missing capability exception is thrown (playing with Quarkus 3 and Kogito 999-SNAPSHOT) P.S. Apparently the whole code generation process in using Jackson directly... Are there any plans to support other serialisers too, or was the decision to go with Jackson intentional and will stay a requirement if Kogito extension is to be used?