此内容没有您所选择的语言版本。

Chapter 3. Creating a Quarkus project on the command line


You can use the Quarkus Maven plug-in on the command line to create a Quarkus project by providing attributes and values on the command line or by using the plug-in in interactive mode. The resulting project will contain the following elements:

  • The Maven structure
  • An associated unit test
  • A landing page that is accessible on http://localhost:8080 after you start the application
  • Example Dockerfile files for JVM and native mode in src/main/docker
  • The application configuration file

Procedure

  1. In a command terminal, enter the following command to verify that Maven is using JDK 11 and that the Maven version is 3.6.3 or higher:

    mvn --version
    Copy to Clipboard Toggle word wrap
  2. If the preceding command does not return JDK 11, add the path to JDK 11 to the PATH environment variable and enter the preceding command again.
  3. To use the Quarkus Maven plug-in to create a new project, use one of the following methods:

    • Enter the following command:

      mvn io.quarkus:quarkus-maven-plugin:1.7.6.Final-redhat-00014:create \
          -DprojectGroupId=<project_group_id> \
          -DprojectArtifactId=<project_artifact_id> \
          -DplatformGroupId=com.redhat.quarkus \
          -DplatformArtifactId=quarkus-universe-bom \
          -DplatformVersion=1.7.6.Final-redhat-00014 \
          -DclassName="<classname>"
      Copy to Clipboard Toggle word wrap

      In this command, replace the following values:

      • <project_group_id>: A unique identifier of your project
      • <project_artifact_id>: The name of your project and your project directory
      • <classname>: The fully qualified name of the generated resource, for example org.acme.quarkus.sample.HelloResource
    • Create the project in interactive mode:

      mvn io.quarkus:quarkus-maven-plugin:1.7.6.Final-redhat-00014:create
      Copy to Clipboard Toggle word wrap

      When prompted, enter the required attribute values.

      Note

      Alternatively, you can create your project using the default values for the project attributes by entering the following command:

      mvn io.quarkus:quarkus-maven-plugin:1.7.6.Final-redhat-00014:create -B

      The following table lists the attributes that you can define with the create command:

      Expand
      AttributeDefault ValueDescription

      projectGroupId

      org.acme.sample

      A unique identifier of your project.

      projectArtifactId

      none

      The name of your project and your project directory. If you do not specify the projectArtifactId, the Maven plug-in starts the interactive mode. If the directory already exists, the generation fails.

      projectVersion

      1.0-SNAPSHOT

      The version of your project.

      platformGroupId

      io.quarkus

      The group id of your platform. All the existing platforms are provided by io.quarkus. However, you can change the default value.

      platformArtifactId

      quarkus-universe-bom

      The artifact id of your platform BOM. To use the locally built Quarkus add quarkus-universe-bom to your pom.xml file.

      platformVersion

      The latest platform version

      The version of the platform you want to use for your project. You can provide a version range and the Maven plug-in uses the latest version.

      className

      None

      The fully qualified name of the generated resource. After the application is created, the REST endpoint is exposed at the following URL:

      http://localhost:8080/$path

      If you use the default path, the URL is http://localhost:8080/hello.

      path

      /hello

      The resource path, only if you set the className.

      extensions

      []

      The list of extensions you want to add to your project separated by comma.

Note

By default, the Quarkus Maven plug-in uses the latest quarkus-universe-bom file. This BOM aggregates extensions so you can reference them from your applications to align the dependency versions. If you are offline, the Quarkus Maven plug-in uses the latest locally available version of the quarkus-universe-bom. If Maven finds the quarkus-universe-bom version 2.0 or earlier, it will use the platform based on the quarkus-universe-bom.

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat