添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
帅气的小摩托  ·  How to Build ...·  4 天前    · 
狂野的黑框眼镜  ·  Python 3.8-dev, ...·  2 天前    · 
沉稳的咖啡豆  ·  How to use pip ...·  2 天前    · 
帅气的闹钟  ·  RequireJS Optimizer·  昨天    · 
听话的感冒药  ·  基于 Cosmos,dbt 和 ...·  2 月前    · 
爱跑步的回锅肉  ·  如何使用 WordPress ...·  3 月前    · 
mvn io.quarkus.platform:quarkus-maven-plugin:3.15.1:create \
    -DprojectGroupId=my-groupId \
    -DprojectArtifactId=my-artifactId

projectArtifactId

mandatory

The artifact id of the created project. Not passing it triggers the interactive mode.

projectVersion

1.0.0-SNAPSHOT

The version of the created project

platformGroupId

io.quarkus.platform

The group id of the target platform.

platformArtifactId

quarkus-bom

The artifact id of the target platform BOM.

platformVersion

The version currently recommended by the Quarkus Extension Registry

The version of the platform you want the project to use. It can also accept a version range, in which case the latest from the specified range will be used.

javaVersion

The version of Java you want the project to use.

className

Not created if omitted

The fully qualified name of the generated resource

/hello

The resource path, only relevant if className is set.

extensions

The list of extensions to add to the project (comma-separated)

quarkusRegistryClient

Whether Quarkus should use the online registry to resolve extension catalogs. If this is set to false, the extension catalog will be narrowed to the defined (or default) platform BOM.

By default, the command will target the io.quarkus.platform:quarkus-bom:3.15.1 platform release (unless the coordinates of the desired platform release have been specified).

The project is generated in a directory named after the passed artifactId. If the directory already exists, the generation fails.

A pair of Dockerfiles for native and jvm mode are also generated in src/main/docker . Instructions to build the image and run the container are written in those Dockerfiles.

The extension name is the GAV name of the extension: e.g., io.quarkus:quarkus-agroal . However, you can pass a partial name, and Quarkus will do its best to find the right extension. For example, agroal , Agroal , or agro will expand to io.quarkus:quarkus-agroal . If no extension is found or more than one extension matches, you will see a red check mark ❌ in the command result.

$ ./mvnw quarkus:add-extensions -Dextensions=jdbc,agroal,non-exist-ent
[...]
❌ Multiple extensions matching 'jdbc'
     * io.quarkus:quarkus-jdbc-h2
     * io.quarkus:quarkus-jdbc-mariadb
     * io.quarkus:quarkus-jdbc-postgresql
     Be more specific e.g using the exact name or the full gav.
✅ Adding extension io.quarkus:quarkus-agroal
❌ Cannot find a dependency matching 'non-exist-ent', maybe a typo?
[...]

You can install all extensions which match a globbing pattern :

quarkus extension add smallrye-*
Maven
./mvnw quarkus:add-extension -Dextensions='smallrye-*'

The Quarkus Maven plugin makes use of javac , and by default it picks up compiler flags to pass to javac from maven-compiler-plugin .

If you need to customize the compiler flags used by the plugin, like in development mode , add a configuration section to the plugin block and set the compilerArgs property just as you would when configuring maven-compiler-plugin . You can also set source , target , and jvmArgs . For example, to pass --enable-preview to both the JVM and javac :

<plugin>
  <groupId>${quarkus.platform.group-id}</groupId>
  <artifactId>quarkus-maven-plugin</artifactId>
  <version>${quarkus.platform.version}</version>
  <configuration>
    <source>${maven.compiler.source}</source>
    <target>${maven.compiler.target}</target>
    <compilerArgs>
      <arg>--enable-preview</arg>
    </compilerArgs>
    <jvmArgs>--enable-preview</jvmArgs>
  </configuration>
</plugin>

Because the Quarkus Maven plugin itself runs in the JVM started by Maven, and because some (rare) Quarkus extensions need to load application classes during the build, it may be necessary to pass the same flags to the JVM running Maven.

To that end, you can use MAVEN_OPTS :

MAVEN_OPTS='--enable-preview' quarkus build
Maven
MAVEN_OPTS='--enable-preview' ./mvnw install

Alternatively , you can simply create the file .mvn/jvm.config at the root of your project: and any options you put in that file will be picked up by Maven, without having to set MAVEN_OPTS .

You can then update the application sources, resources and configurations. The changes are automatically reflected in your running application. This is great to do development spanning UI and database as you see changes reflected immediately.

Dev mode enables hot deployment with background compilation, which means that when you modify your Java files or your resource files and refresh your browser these changes will automatically take effect. This works too for resource files like the configuration property file. The act of refreshing the browser triggers a scan of the workspace, and if any changes are detected the Java files are compiled, and the application is redeployed, then your request is serviced by the redeployed application. If there are any issues with compilation or deployment an error page will let you know.

使用 CTRL+C 来停止应用程序。

By default, quarkus:dev sets the debug host to localhost (for security reasons). If you need to change this, for example to enable debugging on all hosts, you can use the -DdebugHost option like so:

quarkus dev -DdebugHost=0.0.0.0
Maven
./mvnw quarkus:dev -DdebugHost=0.0.0.0

Remote Development Mode

It is possible to use development mode remotely, so that you can run Quarkus in a container environment (such as OpenShift) and have changes made to your local files become immediately visible.

This allows you to develop in the same environment you will actually run your app in, and with access to the same services.

This tells Quarkus to use the mutable-jar format. Mutable applications also include the deployment time parts of Quarkus, so they take up a bit more disk space. If run normally they start just as fast and use the same memory as an immutable application, however they can also be started in dev mode. The password that is used to secure communication between the remote side and the local side. The URL that your app is going to be running in dev mode at. This is only needed on the local side, so you may want to leave it out of the properties file and specify it as a system property on the command line.

The mutable-jar is then built in the same way that a regular Quarkus jar is built, i.e. by issuing:

quarkus build
Maven
./mvnw install

Before you start Quarkus on the remote host set the environment variable QUARKUS_LAUNCH_DEVMODE=true . If you are on bare metal you can set it via the export QUARKUS_LAUNCH_DEVMODE=true command and then run the application with the proper java -jar …​ command to run the application.

If you plan on running the application via Docker, then you’ll need to add -e QUARKUS_LAUNCH_DEVMODE=true to the docker run command. When the application starts you should now see the following line in the logs: Profile dev activated. Live Coding activated . You will also need to give the application the rights to update the deployment resources by adding RUN chmod o+rw -R /deployments after the COPY commands into your Dockerfile. For security reasons, this option should not be added to the production Dockerfile.

The remote side does not need to include Maven or any other development tools. The normal fast-jar Dockerfile that is generated with a new Quarkus application is all you need. If you are using bare metal launch the Quarkus runner jar, do not attempt to run normal dev mode.

Now every time you refresh the browser you should see any changes you have made locally immediately visible in the remote app. This is done via an HTTP based long polling transport, that will synchronize your local workspace and the remote application via HTTP calls.

If you do not want to use the HTTP feature then you can simply run the remote-dev command without specifying the URL. In this mode the command will continuously rebuild the local application, so you can use an external tool such as odo or rsync to sync to the remote application.

All the config options are shown below:

Configuration property fixed at build time - All other configuration properties are overridable at runtime

Whether Quarkus should enable its ability to not do a full restart when changes to classes are compatible with JVM instrumentation. If this is set to true, Quarkus will perform class redefinition when possible.

Environment variable: QUARKUS_LIVE_RELOAD_INSTRUMENTATION