Getting error when executing the Java project with Quarkus Maven plugin (Java jdk-17.jd version and Maven 3.9.0

huangapple go评论61阅读模式
英文:

Getting error when executing the Java project with Quarkus Maven plugin (Java jdk-17.jd version and Maven 3.9.0

问题

我在使用Quarkus Maven插件执行项目时遇到以下错误。我执行的脚本如下:

mvn -U io.quarkus:quarkus-maven-plugin:create \
    -DprojectGroupId=org.test.quarkus.microservices \
    -DprojectArtifactId=rest-number \
    -DclassName="org.test.quarkus.microservices.number.NumberResource" \
    -Dpath="/api/numbers" \
    -Dextensions="resteasy-jsonb, smallrye-openapi"

错误信息如下:

[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:3.0.0.Alpha4:create (default-cli) on project standalone-pom: Execution default-cli of goal io.quarkus:quarkus-maven-plugin:3.0.0.Alpha4:create failed: A required class was missing while executing io.quarkus:quarkus-maven-plugin:3.0.0.Alpha4:create: org/eclipse/aether/connector/basic/BasicRepositoryConnectorFactory

英文:

I' m getting the below error when I execute a project in using Quarkus maven plugin. The script executed by me was

mvn -U io.quarkus:quarkus-maven-plugin:create \
    -DprojectGroupId=org.test.quarkus.microservices \
    -DprojectArtifactId=rest-number \
    -DclassName="org.test.quarkus.microservices.number.NumberResource" \
    -Dpath="/api/numbers" \
    -Dextensions="resteasy-jsonb, smallrye-openapi"

> [ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:3.0.0.Alpha4:create (default-cli) on project standalone-pom: Execution default-cli of goal io.quarkus:quarkus-maven-plugin:3.0.0.Alpha4:create failed: A required class was missing while executing io.quarkus:quarkus-maven-plugin:3.0.0.Alpha4:create: org/eclipse/aether/connector/basic/BasicRepositoryConnectorFactory

答案1

得分: 2

问题

Maven 3.9.0 使用org.apache.maven.resolver:maven-resolver-connector-basic:1.9.4 作为一个传递库。

create 目标可能引用了org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory。然而该类存在,运行该目标会抛出java.lang.ClassNotFoundException

经过一些调查,似乎只有create 目标受到影响。

解决方法

如果可能的话,降级 Maven 版本。

Maven 发行版归档可在此处找到:https://archive.apache.org/dist/maven/maven-3/

我已经测试了 3.8.73.8.4,它们都正常工作。

备选解决方案

另外,Quarkus 提供了一个命令行界面。https://quarkus.io/guides/cli-tooling

我没有测试过。

防护解决方案

这里提供了一个出色的交互式配置页面:https://code.quarkus.io/

正如我所提到的,生成的项目将与 Maven 3.9.0 兼容。

2023年4月更新

已经解决了问题,并发布在 Quarkus 3.x 分支中(特别是 Quarkus 3.0.0.CR1)。不幸的是,没有承诺将此错误修复合并到 Quarkus 2.x 中。

英文:

The problem

Maven 3.9.0 using
org.apache.maven.resolver:maven-resolver-connector-basic:1.9.4 as a transitive library.

The create goal probably referenced to
org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory. Howerver that class exists, running the goal throws a java.lang.ClassNotFoundException.

After some investigation it seems only create goal affected.

Workaround

Downgrade Maven version if it is possible.

Maven release archive is available here: https://archive.apache.org/dist/maven/maven-3/

I've tested with 3.8.7 and 3.8.4, and both of them work properly.

Alternate solution

Alternatively Quarkus has a command line interface. https://quarkus.io/guides/cli-tooling

I didn't tested.

Bulletproof solution

An awesome interactive configurator page available here: https://code.quarkus.io/

As I mentioned the generated project will work with Maven 3.9.0

Update on Apr, 2023

The reported issue have already been resolved and released in Quarkus 3.x stream (especially Quarkus 3.0.0.CR1) Unfortunately there's no commitment to backport this bugfix into Quarkus 2.x.

huangapple
  • 本文由 发表于 2023年2月24日 03:04:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/75549256.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定