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

Unable to generate a project using Maven and Quarkus 2.6, ClassCastException, using also registry.quarkus.redhat.com #22496

Closed
rsvoboda opened this issue Dec 23, 2021 · 1 comment · Fixed by #22503
Labels
area/maven kind/bug Something isn't working
Milestone

Comments

@rsvoboda
Copy link
Member

Describe the bug

Unable to generate a project using Maven and Quarkus 2.6, getting ClassCastException

Using command from https://quarkus.io/guides/getting-started#bootstrapping-the-project

Have both registry.quarkus.redhat.com and registry.quarkus.io enabled

Getting:

 mvn -e io.quarkus.platform:quarkus-maven-plugin:2.6.0.Final:create \ 
    -DprojectGroupId=org.acme \
    -DprojectArtifactId=getting-started \
    -DclassName="org.acme.getting.started.GreetingResource" \
    -Dpath="/hello"
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- quarkus-maven-plugin:2.6.0.Final:create (default-cli) @ standalone-pom ---
[WARNING] Failed to resolve the extension catalog: Failed to resolve artifact com.redhat.quarkus.platform:quarkus-bom-quarkus-platform-descriptor:json:2.2.3.SP1-redhat-00002:2.2.3.SP1-redhat-00002: com.redhat.quarkus.platform:quarkus-bom-quarkus-platform-descriptor:json:2.2.3.SP1-redhat-00002:2.2.3.SP1-redhat-00002 was not found in https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced: com.redhat.quarkus.platform:quarkus-bom-quarkus-platform-descriptor:json:2.2.3.SP1-redhat-00002:2.2.3.SP1-redhat-00002 was not found in https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced
[WARNING] The extension catalog will be narrowed to the io.quarkus.platform:quarkus-bom:2.6.0.Final platform release. To enable the complete Quarkiverse extension catalog along with the latest recommended platform releases, please, make sure the following registries are accessible from your environment: registry.quarkus.redhat.com, registry.quarkus.io
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.366 s
[INFO] Finished at: 2021-12-23T13:55:13+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:2.6.0.Final:create (default-cli) on project standalone-pom: A type incompatibility occurred while executing io.quarkus.platform:quarkus-maven-plugin:2.6.0.Final:create: class io.quarkus.registry.catalog.ExtensionCatalogImpl cannot be cast to class io.quarkus.registry.catalog.ExtensionCatalog$Mutable (io.quarkus.registry.catalog.ExtensionCatalogImpl and io.quarkus.registry.catalog.ExtensionCatalog$Mutable are in unnamed module of loader org.codehaus.plexus.classworlds.realm.ClassRealm @26f96b85)
...
Caused by: java.lang.ClassCastException: class io.quarkus.registry.catalog.ExtensionCatalogImpl cannot be cast to class io.quarkus.registry.catalog.ExtensionCatalog$Mutable (io.quarkus.registry.catalog.ExtensionCatalogImpl and io.quarkus.registry.catalog.ExtensionCatalog$Mutable are in unnamed module of loader org.codehaus.plexus.classworlds.realm.ClassRealm @26f96b85)
    at io.quarkus.platform.tools.ToolsUtils.resolvePlatformDescriptorDirectly (ToolsUtils.java:158)
    at io.quarkus.maven.CreateProjectMojo.resolveExtensionCatalogDirectly (CreateProjectMojo.java:380)
    at io.quarkus.maven.CreateProjectMojo.resolveExtensionsCatalog (CreateProjectMojo.java:349)
    at io.quarkus.maven.CreateProjectMojo.execute (CreateProjectMojo.java:222)

In the end, the root cause is the fact that I have https://maven.repository.redhat.com/ga/ repository defined in a separate rh profile in my ~/.m2/settings.xml and I need to add -Prh to the command to successfully run quarkus-maven-plugin:2.6.0.Final:create command.
Or another way around this is to do mv ~/.quarkus/config.yaml ~/.quarkus/config.yamlXXX :)

User experience is very poor in this scenario and quarkus-maven-plugin should be able to detect and react better way when artifacts defined in one of the registries are not reachable.

Expected behavior

Project gets generated

Actual behavior

Project is not generated, Maven command execution failure

How to Reproduce?

https://quarkus.io/guides/getting-started#bootstrapping-the-project

cat ~/.quarkus/config.yaml 
---
registries:
- registry.quarkus.redhat.com
- registry.quarkus.io

Do not have https://maven.repository.redhat.com/ga/ enabled by default in your ~/.m2/settings.xml

mvn io.quarkus.platform:quarkus-maven-plugin:2.6.0.Final:create \
    -DprojectGroupId=org.acme \
    -DprojectArtifactId=getting-started \
    -DclassName="org.acme.getting.started.GreetingResource" \
    -Dpath="/hello"

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

2.6.0.Final

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

No response

Additional information

No response

@rsvoboda rsvoboda added the kind/bug Something isn't working label Dec 23, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Dec 23, 2021

/cc @quarkusio/devtools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/maven kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants