Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading to 1.1.0 causes build to fail #25

Open
kdubb opened this issue Feb 22, 2023 · 8 comments
Open

Upgrading to 1.1.0 causes build to fail #25

kdubb opened this issue Feb 22, 2023 · 8 comments

Comments

@kdubb
Copy link

kdubb commented Feb 22, 2023

When I change from 1.0.0 to 1.1.0 I get the following error:

Caused by: java.lang.ClassCastException: class org.kordamp.gradle.plugin.jandex.Banner$Inject cannot be cast to class org.kordamp.gradle.plugin.jandex.Banner (org.kordamp.gradle.plugin.jandex.Banner$Inject is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader @2bab28a6; org.kordamp.gradle.plugin.jandex.Banner is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader @146b18e4)
        at org.kordamp.gradle.plugin.jandex.JandexPlugin.apply(JandexPlugin.groovy:45)
        at org.kordamp.gradle.plugin.jandex.JandexPlugin.apply(JandexPlugin.groovy)
        at org.gradle.api.internal.plugins.ImperativeOnlyPluginTarget.applyImperative(ImperativeOnlyPluginTarget.java:43)
        at org.gradle.api.internal.plugins.RuleBasedPluginTarget.applyImperative(RuleBasedPluginTarget.java:51)
        at org.gradle.api.internal.plugins.DefaultPluginManager.addPlugin(DefaultPluginManager.java:187)
        at org.gradle.api.internal.plugins.DefaultPluginManager.access$100(DefaultPluginManager.java:52)
        at org.gradle.api.internal.plugins.DefaultPluginManager$AddPluginBuildOperation.run(DefaultPluginManager.java:282)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68)
        at org.gradle.api.internal.plugins.DefaultPluginManager.lambda$doApply$0(DefaultPluginManager.java:167)
        at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:44)
        at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:166)
        ... 174 more

Running with --quiet seems to get past the error.

@kdubb
Copy link
Author

kdubb commented Feb 22, 2023

It's a Quarkus 2.15 project using Gradle 7.5.1

@kdubb
Copy link
Author

kdubb commented Feb 22, 2023

I just realized this is only in a single module of a multi-module project. The projects has 8 modules 2 of which apply Jandex. If I remove it from the module that generates the error and leave it in the other module the build still works fine.

@kiwi-oss
Copy link

We get the exactly same error when trying to upgrade from 1.0.0 to 1.1.0.

We're using Quarkus 2.16.5 and Gradle 8.0.2.

@aalmiray
Copy link
Collaborator

Cannot replicate with Quarkus 2.16.5, Gradle 8.0.2.

These are the classes created by the plugin

$ tree build/classes/
build/classes/
└── groovy
    └── main
        └── org
            └── kordamp
                └── gradle
                    └── plugin
                        └── jandex
                            ├── Banner$Params.class
                            ├── Banner.class
                            ├── JandexExtension.class
                            ├── JandexPlugin$1.class
                            ├── JandexPlugin$2.class
                            ├── JandexPlugin$3.class
                            ├── JandexPlugin$4.class
                            ├── JandexPlugin$5.class
                            ├── JandexPlugin$_apply_closure1.class
                            ├── JandexPlugin.class
                            ├── internal
                            │   ├── DefaultVersions.class
                            │   └── JandexExtensionImpl.class
                            └── tasks
                                ├── JandexTask$1.class
                                ├── JandexTask$2.class
                                ├── JandexTask$3.class
                                ├── JandexTask.class
                                ├── JandexWorkAction$ClassFileVisitor.class
                                ├── JandexWorkAction.class
                                └── JandexWorkParameters.class

I don't see a org.kordamp.gradle.plugin.jandex.Banner$Inject class. It might be coming from some internal Gradle plumbing.

@aalmiray
Copy link
Collaborator

Do you have a reproducible repository you may link to?

@kiwi-oss
Copy link

Thanks for looking into it. Next week, I will create a minimal reproducible project and link to it.

kiwi-oss added a commit to kiwi-oss/jandex_1.1.0_bug_reproducer that referenced this issue Apr 5, 2023
The error occurs when building with `./gradlew assemble` using the
Jandex Gradle plugin in version 1.1.0.
[See the GitHub issue for details](kordamp/jandex-gradle-plugin#25).
kiwi-oss added a commit to kiwi-oss/jandex_1.1.0_bug_reproducer that referenced this issue Apr 5, 2023
The error occurs when building with `./gradlew assemble` using the
Jandex Gradle plugin in version 1.1.0.
[See the GitHub issue for details](kordamp/jandex-gradle-plugin#25).
@kiwi-oss
Copy link

kiwi-oss commented Apr 5, 2023

Here's the repository to reproduce the issue. It has the same structure as the actual project, but contains only the very basic files.

Instructions to reproduce are in the readme file.

@briancullen
Copy link

briancullen commented Mar 10, 2024

I know this is an old issue but I had a similar problem, which is how I can across this. Eventually I found putting the following at the top of the root build.gradle.kts (I'm using kotlin instead of groovy) sorted it out. For groovy I think the only change you need to make is remove the second line where we define the value.

I currently don't know why this solved my problem and it is possible that is is something to do with my setup. I have not tried it with the reproducer but it might be worth trying if you are stuck. For reference this was not necessary if I was using version 1.0.0 of the jandex plugin, this is using gradle 8.6 and quarkus 3.8.2.

buildscript {
    val quarkusPluginVersion: String by project
    repositories {
        gradlePluginPortal()
    }

    dependencies {
        classpath("io.quarkus:io.quarkus.gradle.plugin:$quarkusPluginVersion")
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants