The English version of is the official project site. Translated sites are community supported on a best-effort basis.

Volver a medir una aplicación de Quarkus

¿Qué es el proceso de aumento?

La configuración de la aplicación Quarkus puede incluir dos tipos de opciones de configuración:

  • Opciones de tiempo de construcción, manejadas durante el tiempo de construcción de la aplicación;

  • Opciones de tiempo de ejecución, que pueden ajustarse después de la construcción de la aplicación pero antes de su lanzamiento.

The augmentation is a phase of an application build process during which the byte code of the application is optimized according to the application build time configuration. Initialization steps that used to happen when an EAR file was deployed on a Jakarta EE server such as parsing static configuration, creating proxy instances, etc. now happen at augmentation time. CDI beans added after augmentation won’t work (because of the missing proxy classes) as well as build time properties (e.g. quarkus.datasource.db-kind) changed after augmentation will be ignored. Build time properties are marked with a lock icon () in the list of all configuration options. It doesn’t matter if you use profiles or any other way to override the properties.

La re-aumentación es el proceso de recrear la salida de aumento para una configuración de tiempo de construcción diferente

¿Cuándo es útil la re-aumentación?

Re-augmentation is useful in case the users of your application want to be able to change some of its build time properties. For instance changing the database driver or switching features on or off (e.g. OpenTelemetry or Config Consul). If there are only two or three build time properties that depend on the user environment, you may consider providing alternative builds of the application. However, in case there are more such properties you may prefer shipping a mutable jar instead and let your users re-augment the application for their environment. Please notice that you won’t be able to use native images with the package type mutable-jar. Think of the consequences and what other options you have!

It is not a good idea to do re-augmentation at runtime unless you miss the good old times when starting up a server took several minutes, and you could enjoy a cup of coffee until it was ready.

Cómo volver a aumentar una aplicación de Quarkus

In order to run the augmentation steps you need the deployment JARs of the used Quarkus extensions. These JARs are only present in the mutable-jar distribution. This means that you need to build your application with quarkus.package.type=mutable-jar. The mutable-jar distribution is the same as the fast-jar distribution, except for the additional folder quarkus-app/lib/deployment which contains the deployment JARs and their dependencies (and some class-loader configuration).

By default, you’ll get a warning if a build time property has been changed at runtime. You may set the property to make sure your application does not start up if there is a mismatch. However, as of this writing changing quarkus.datasource.db-kind at runtime did neither fail nor produce a warning but was silently ignored.
Build time configuration provided by build tools (properties in Maven pom.xml or in Gradle) in the quarkus namespace will be part of the mutable-jar distribution, including configuration from quarkus that reference secrets or passwords. Please, do not include sensitive information in the build tool configuration files.

1. Construya su aplicación como mutable-jar

mvn clean install -Dquarkus.package.type=mutable-jar

2. Vuelva a calibrar su aplicación con una configuración de tiempo de compilación diferente

Para volver a aumentar su aplicación Quarkus con diferentes propiedades de tiempo de compilación, inicie la aplicación con la configuración deseada más la propiedad del sistema quarkus.launch.rebuild establecida en true.

El siguiente ejemplo cambia el quarkus.datasource.db-kind por mysql. Para que esto funcione el mysql-extension debe haber sido incluido en la compilación. La ampliación sólo puede utilizar las extensiones que estaban presentes en el momento de la compilación.

java -jar -Dquarkus.launch.rebuild=true -Dquarkus.datasource.db-kind=mysql target/quarkus-app/quarkus-run.jar
It does not matter if you use system properties, environment variables, profiles, or an external config file. The current configuration will be used for augmentation (the content of quarkus-app/quarkus will be replaced with the new augmentation output). The command line above will not launch the application. Quarkus will exit immediately after the application has been re-augmented.

3. Opcional: Eliminar la carpeta de despliegues

Puedes eliminar el directorio quarkus-app/lib/deployment para ahorrar algo de espacio en tu distribución ZIP o imagen Docker (recuerda utilizar una construcción Docker multietapa para evitar capas innecesarias). Después de eliminar el directorio deployment, obviamente ya no es posible volver a aumentar la aplicación.