quarkiverse / quarkus-argocd

An ArgoCD extension for Quarkus
https://docs.quarkiverse.io/quarkus-argocd/dev
Apache License 2.0
0 stars 2 forks source link

IllegalArgumentException: Undeclared build item class #33

Open cmoulliard opened 1 month ago

cmoulliard commented 1 month ago

Issue

When we execute the following command in a quarkus project, not yet published on a git repository, we got this error

/Users/cmoullia/code/ch007m/code-with-quarkus $ quarkus argocd application generate                                   
[jbang] [WARN] Detected missing or out-of-date dependencies in cache.
[jbang] Resolving dependencies...
[jbang]    io.quarkiverse.argocd:quarkus-argocd-cli:999-SNAPSHOT
[jbang] Dependencies resolved
java.lang.IllegalArgumentException: Undeclared build item class io.quarkiverse.argocd.spi.ArgoCDApplicationListBuildItem
        at io.quarkus.builder.Messages.undeclaredItem(Messages.java:13)
        at io.quarkus.builder.BuildResult.consume(BuildResult.java:50)
        at io.quarkiverse.argocd.cli.handlers.GetArgoCDApplicationHandler.accept(GetArgoCDApplicationHandler.java:14)
        at io.quarkiverse.argocd.cli.handlers.GetArgoCDApplicationHandler.accept(GetArgoCDApplicationHandler.java:10)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.performCustomBuild(AugmentActionImpl.java:160)
        at io.quarkiverse.argocd.cli.application.GenerateCommand.call(GenerateCommand.java:58)
        at io.quarkiverse.argocd.cli.application.GenerateCommand.call(GenerateCommand.java:25)

@iocanel

Originally posted by @cmoulliard in https://github.com/quarkiverse/quarkus-argocd/issues/24#issuecomment-2370559697

iocanel commented 1 month ago

I can't reporduce

cmoulliard commented 1 month ago

How to reproduce:

  1. Terminal 1
    
    git clone https://github.com/quarkiverse/quarkus-argocd.git
    cd quarkus-argocd
    mvn install
    quarkus plug ls
    No plugins installed!
    To include the installable plugins in the list, append --installable to the command.
    quarkus plug add io.quarkiverse.argocd:quarkus-argocd-cli:999-SNAPSHOT

Added plugin: Name Type Scope Location Description

quarkus plug add io.quarkiverse.argocd:quarkus-argocd-cli:999-SNAPSHOT Added plugin: Name Type Scope Location Description

quarkus argocd application generate [jbang] [WARN] Detected missing or out-of-date dependencies in cache. [jbang] Resolving dependencies... [jbang] io.quarkiverse.argocd:quarkus-argocd-cli:999-SNAPSHOT [jbang] Dependencies resolved java.lang.IllegalArgumentException: Undeclared build item class io.quarkiverse.argocd.spi.ArgoCDApplicationListBuildItem at io.quarkus.builder.Messages.undeclaredItem(Messages.java:13) at io.quarkus.builder.BuildResult.consume(BuildResult.java:50) at io.quarkiverse.argocd.cli.handlers.GetArgoCDApplicationHandler.accept(GetArgoCDApplicationHandler.java:14) at io.quarkiverse.argocd.cli.handlers.GetArgoCDApplicationHandler.accept(GetArgoCDApplicationHandler.java:10) at io.quarkus.runner.bootstrap.AugmentActionImpl.performCustomBuild(AugmentActionImpl.java:160) at io.quarkiverse.argocd.cli.application.GenerateCommand.call(GenerateCommand.java:58) at io.quarkiverse.argocd.cli.application.GenerateCommand.call(GenerateCommand.java:25) at picocli.CommandLine.executeUserObject(CommandLine.java:2045) at picocli.CommandLine.access$1500(CommandLine.java:148) at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2465) at picocli.CommandLine$RunLast.handle(CommandLine.java:2457) at picocli.CommandLine$RunLast.handle(CommandLine.java:2419) at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2277) at picocli.CommandLine$RunLast.execute(CommandLine.java:2421) at io.quarkus.picocli.runtime.PicocliRunner$EventExecutionStrategy.execute(PicocliRunner.java:26) at picocli.CommandLine.execute(CommandLine.java:2174) at io.quarkus.picocli.runtime.PicocliRunner.run(PicocliRunner.java:40) at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:132) at io.quarkus.runtime.Quarkus.run(Quarkus.java:71) at io.quarkus.runtime.Quarkus.run(Quarkus.java:44) at io.quarkus.runner.GeneratedMain.main(Unknown Source)


@iocanel 
cmoulliard commented 1 month ago

This github flow reproduces too the error: https://github.com/quarkiverse/quarkus-argocd/actions/runs/11018349049/job/30598408941 @iocanel

cmoulliard commented 1 month ago

The problem still exists. See: https://github.com/quarkiverse/quarkus-argocd/actions/runs/11034548454/job/30648368290 I was able to reproduce it locally

We got the error when the extension is not part of pom.xml file

Screenshot 2024-09-26 at 08 57 40

and not when the extension is there

Screenshot 2024-09-26 at 08 58 07

cmoulliard commented 1 month ago

Is it possible that when we create here https://github.com/ch007m/quarkus-argocd/blob/main/cli/src/main/java/io/quarkiverse/argocd/cli/application/GenerationBaseCommand.java#L58-L70 the QuarkusBootstrap object that such an object will also use the dependencies part of the pom.xml as jar/artifacts to its classloader ? @iocanel @geoand

geoand commented 1 month ago

I am afraid I don't understand what you are asking with ^.

cmoulliard commented 1 month ago

I am afraid I don't understand what you are asking with ^.

This is pretty simple. Why is the ArgoCD CLI and QuarkusBootstrap working when the following dependency is part of the pom.xml file of the project where we run "quarkus argocd application generate". Look also to the screenshots

        <dependency>
            <groupId>io.quarkiverse.argocd</groupId>
            <artifactId>quarkus-argocd</artifactId>
            <version>999-SNAPSHOT</version>
        </dependency>

As the Quarkus Argocd CLI needs such a pom dependency declared within the Quarkus project (aka code-quarkus example) where the command will be executed, what should we do to avoid that ?