0
# Quarkus Core Deployment
1
2
Quarkus Core Deployment provides the fundamental deployment-time APIs and infrastructure for building Quarkus applications. It enables Quarkus's container-first approach with support for native compilation via GraalVM, development-time features like hot reloading, and a comprehensive build system for creating cloud-native Java applications with minimal footprint and lightning-fast startup times.
3
4
## Package Information
5
6
- **Package Name**: io.quarkus:quarkus-core-deployment
7
- **Package Type**: Maven
8
- **Language**: Java
9
- **Installation**: Add to your Maven `pom.xml`:
10
11
```xml
12
<dependency>
13
<groupId>io.quarkus</groupId>
14
<artifactId>quarkus-core-deployment</artifactId>
15
<version>3.23.0</version>
16
</dependency>
17
```
18
19
## Core Imports
20
21
```java
22
// Main augmentation engine
23
import io.quarkus.deployment.QuarkusAugmentor;
24
import io.quarkus.deployment.BuildResult;
25
26
// Build step annotations
27
import io.quarkus.deployment.annotations.BuildStep;
28
import io.quarkus.deployment.annotations.BuildProducer;
29
import io.quarkus.deployment.annotations.Record;
30
import io.quarkus.deployment.annotations.ExecutionTime;
31
32
// Core build items
33
import io.quarkus.deployment.builditem.ApplicationArchivesBuildItem;
34
import io.quarkus.deployment.builditem.CapabilityBuildItem;
35
import io.quarkus.deployment.builditem.FeatureBuildItem;
36
import io.quarkus.deployment.builditem.LaunchModeBuildItem;
37
38
// Application archives and capabilities
39
import io.quarkus.deployment.ApplicationArchive;
40
import io.quarkus.deployment.Capabilities;
41
import io.quarkus.deployment.Capability;
42
```
43
44
## Basic Usage
45
46
```java
47
// Creating an augmentor for build processing
48
QuarkusAugmentor augmentor = QuarkusAugmentor.builder()
49
.setRoot(applicationRoot)
50
.addBuildChainCustomizer(chainCustomizer)
51
.build();
52
53
BuildResult result = augmentor.run();
54
55
// Example build step for extension development
56
@BuildStep
57
CapabilityBuildItem capability() {
58
return new CapabilityBuildItem(Capability.REST);
59
}
60
61
@BuildStep
62
void registerFeature(BuildProducer<FeatureBuildItem> features) {
63
features.produce(new FeatureBuildItem(Feature.REST));
64
}
65
66
// Recording runtime initialization code
67
@BuildStep
68
@Record(ExecutionTime.RUNTIME_INIT)
69
void configureRuntime(MyRecorder recorder,
70
LaunchModeBuildItem launchMode) {
71
recorder.initialize(launchMode.getLaunchMode());
72
}
73
```
74
75
## Architecture
76
77
The Quarkus Core Deployment module follows a producer-consumer build system architecture:
78
79
- **Build Steps**: Methods annotated with `@BuildStep` that form the build chain
80
- **Build Items**: Immutable data objects passed between build steps
81
- **Augmentor**: Orchestrates the entire build process
82
- **Recorders**: Generate bytecode for runtime execution
83
- **Archives**: Represent application and dependency code
84
85
### Core Components
86
87
```java { .api }
88
// Main augmentation orchestrator
89
class QuarkusAugmentor {
90
static Builder builder();
91
BuildResult run() throws Exception;
92
93
static class Builder {
94
Builder setRoot(PathCollection root);
95
Builder addBuildChainCustomizer(Consumer<BuildChainBuilder> customizer);
96
QuarkusAugmentor build();
97
}
98
}
99
100
// Build execution result
101
class BuildResult {
102
List<Consumer<BuildChainBuilder>> getBuildChainCustomizers();
103
ClassLoader getBaseRuntimeClassLoader();
104
}
105
```
106
107
### Application Archives
108
109
```java { .api }
110
interface ApplicationArchive {
111
IndexView getIndex();
112
PathCollection getRootDirectories();
113
PathCollection getResolvedPaths();
114
ArtifactKey getKey();
115
ResolvedDependency getResolvedDependency();
116
<T> T apply(Function<OpenPathTree, T> func);
117
void accept(Consumer<OpenPathTree> func);
118
Path getChildPath(String path);
119
}
120
```
121
122
### Capabilities Management
123
124
```java { .api }
125
class Capabilities extends SimpleBuildItem {
126
Set<String> getCapabilities();
127
boolean isPresent(String capability);
128
boolean isMissing(String capability);
129
boolean isCapabilityWithPrefixPresent(String capabilityPrefix);
130
}
131
132
interface Capability {
133
String QUARKUS_PREFIX = "io.quarkus";
134
String CDI = "io.quarkus.cdi";
135
String REST = "io.quarkus.rest";
136
String SECURITY = "io.quarkus.security";
137
String HIBERNATE_ORM = "io.quarkus.hibernate.orm";
138
String KAFKA_CLIENT = "io.quarkus.kafka.client";
139
// Additional capability constants...
140
}
141
```
142
143
## Capabilities
144
145
### Build System Integration
146
147
Core build step annotations, build item management, and the producer-consumer dependency model that powers Quarkus's build chain.
148
149
```java { .api }
150
@interface BuildStep {
151
Class<? extends BooleanSupplier>[] onlyIf() default {};
152
Class<? extends BooleanSupplier>[] onlyIfNot() default {};
153
}
154
155
interface BuildProducer<T extends BuildItem> {
156
void produce(T item);
157
void produce(Collection<T> items);
158
}
159
160
@interface Record {
161
ExecutionTime value() default ExecutionTime.RUNTIME_INIT;
162
boolean optional() default false;
163
boolean useIdentityComparisonForParameters() default false;
164
}
165
166
enum ExecutionTime {
167
STATIC_INIT,
168
RUNTIME_INIT
169
}
170
```
171
172
[Build System](./build-system.md)
173
174
### Configuration Management
175
176
Build-time and runtime configuration processing, type-safe configuration binding, and configuration root definitions.
177
178
```java { .api }
179
class BuildTimeConfigurationReader {
180
static RunTimeConfigurationGenerator.ReadResult readConfiguration(
181
Path applicationRoot,
182
Path outputDirectory,
183
ConfigMappingContext configMappingContext,
184
LaunchMode launchMode
185
);
186
}
187
188
class RunTimeConfigurationGenerator {
189
static void generate(ReadResult readResult,
190
ClassOutput classOutput,
191
LaunchMode launchMode);
192
193
static class ReadResult {
194
Config getConfig();
195
Set<String> getPropertyNames();
196
}
197
}
198
```
199
200
[Configuration](./configuration.md)
201
202
### Development Mode Support
203
204
Hot reloading, file watching, compilation providers, and development services for enhanced developer experience.
205
206
```java { .api }
207
class RuntimeUpdatesProcessor {
208
static RuntimeUpdatesProcessor INSTANCE;
209
210
boolean doScan(boolean userInitiated, boolean forceRestart);
211
void addHotReplacementSetup(HotReplacementSetup service);
212
ClassScanResult checkForChangedClasses();
213
}
214
215
interface CompilationProvider {
216
Set<String> handledExtensions();
217
void compile(Set<File> filesToCompile, Context context);
218
219
interface Context {
220
Path getSourceDirectory();
221
Path getOutputDirectory();
222
ClassLoader getClasspathClassLoader();
223
}
224
}
225
226
class DevModeContext {
227
List<ModuleInfo> getAllModules();
228
Path getApplicationRoot();
229
String[] getArgs();
230
LaunchMode getLaunchMode();
231
}
232
```
233
234
[Development Mode](./dev-mode.md)
235
236
### Application Packaging
237
238
JAR building, native image compilation, container image creation, and deployment artifact generation.
239
240
```java { .api }
241
class PackageConfig {
242
PackageType type = PackageType.JAR;
243
String outputName;
244
String outputDirectory;
245
boolean createAppcds = true;
246
AppcdsConfig appcds;
247
248
enum PackageType {
249
JAR, LEGACY_JAR, FAST_JAR, NATIVE, NATIVE_SOURCES, UBER_JAR, MUTABLE_JAR
250
}
251
}
252
253
class NativeConfig {
254
boolean enabled = false;
255
List<String> additionalBuildArgs;
256
String builderImage = "quay.io/quarkus/ubi-quarkus-mandrel-builder-image";
257
ContainerRuntimeConfig containerRuntime;
258
String graalvmHome;
259
}
260
261
class JarBuildItem extends SimpleBuildItem {
262
Path getPath();
263
PackageType getType();
264
Path getLibraryDir();
265
}
266
```
267
268
[Packaging](./packaging.md)
269
270
### Utilities and Helpers
271
272
Reflection utilities, service loading helpers, file system operations, and container runtime detection.
273
274
```java { .api }
275
class ReflectUtil {
276
static Method getMethod(Class<?> clazz, String name, Class<?>... parameterTypes);
277
static Field getField(Class<?> clazz, String name);
278
static <T> T newInstance(Class<T> clazz);
279
static Object invoke(Method method, Object instance, Object... args);
280
}
281
282
class ServiceUtil {
283
static <T> List<T> classPathServices(Class<T> serviceType, ClassLoader classLoader);
284
static <T> Optional<T> classPathService(Class<T> serviceType, ClassLoader classLoader);
285
}
286
287
class FileUtil {
288
static void copyFile(Path source, Path target);
289
static boolean isDirectoryEmpty(Path directory);
290
static void deleteDirectory(Path directory);
291
static String relativize(Path base, Path child);
292
}
293
```
294
295
[Utilities](./utilities.md)
296
297
## Types
298
299
### Build Items
300
301
```java { .api }
302
// Base classes for build items
303
abstract class SimpleBuildItem extends BuildItem {}
304
abstract class MultiBuildItem extends BuildItem {}
305
306
// Core application build items
307
class ApplicationArchivesBuildItem extends SimpleBuildItem {
308
ApplicationArchive getRootArchive();
309
Collection<ApplicationArchive> getApplicationArchives();
310
Set<ApplicationArchive> getAllApplicationArchives();
311
ApplicationArchive containingArchive(String className);
312
ApplicationArchive containingArchive(DotName className);
313
}
314
315
class CapabilityBuildItem extends MultiBuildItem {
316
String getName();
317
String getProvider();
318
}
319
320
class FeatureBuildItem extends MultiBuildItem {
321
String getName();
322
}
323
324
class LaunchModeBuildItem extends SimpleBuildItem {
325
LaunchMode getLaunchMode();
326
Optional<DevModeType> getDevModeType();
327
boolean isNotLocalDevModeType();
328
boolean isAuxiliaryApplication();
329
boolean isTest();
330
}
331
332
class MainClassBuildItem extends SimpleBuildItem {
333
String getClassName();
334
}
335
```
336
337
### Core Enums
338
339
```java { .api }
340
enum Feature {
341
AGROAL("agroal"),
342
AMAZON_LAMBDA("amazon-lambda"),
343
CDI("cdi"),
344
HIBERNATE_ORM("hibernate-orm"),
345
KAFKA_CLIENT("kafka-client"),
346
KUBERNETES("kubernetes"),
347
REST("rest"),
348
SECURITY("security");
349
// Additional features...
350
351
String getName();
352
}
353
354
enum LaunchMode {
355
NORMAL,
356
DEVELOPMENT,
357
TEST;
358
}
359
360
enum DevModeType {
361
LOCAL,
362
REMOTE_LOCAL_SIDE,
363
REMOTE_SERVER_SIDE
364
}
365
```
366
367
### Native Image Build Items
368
369
```java { .api }
370
class ReflectiveClassBuildItem extends MultiBuildItem {
371
String getClassName();
372
boolean isConstructors();
373
boolean isMethods();
374
boolean isFields();
375
boolean isWeak();
376
}
377
378
class NativeImageResourceBuildItem extends MultiBuildItem {
379
List<String> getResources();
380
}
381
382
class RuntimeInitializedClassBuildItem extends MultiBuildItem {
383
String getClassName();
384
}
385
386
class JniRuntimeAccessBuildItem extends MultiBuildItem {
387
boolean isConstructors();
388
boolean isMethods();
389
boolean isFields();
390
String getClassName();
391
}
392
```