0
# Micronaut Core BOM
1
2
Micronaut Core BOM (Bill of Materials) provides centralized dependency management for the entire Micronaut Framework ecosystem. It ensures version compatibility across all Micronaut Core modules and manages external dependency versions, eliminating version conflicts and simplifying dependency declarations in Micronaut applications.
3
4
## Package Information
5
6
- **Package Name**: micronaut-core-bom
7
- **Package Type**: maven
8
- **Language**: Java (Build Tool Configuration)
9
- **Installation**: Import as BOM in Maven/Gradle
10
- **Group ID**: io.micronaut
11
- **Artifact ID**: micronaut-core-bom
12
- **Version**: 4.9.4
13
14
## Core Imports
15
16
### Maven
17
18
```xml
19
<dependencyManagement>
20
<dependencies>
21
<dependency>
22
<groupId>io.micronaut</groupId>
23
<artifactId>micronaut-core-bom</artifactId>
24
<version>4.9.4</version>
25
<type>pom</type>
26
<scope>import</scope>
27
</dependency>
28
</dependencies>
29
</dependencyManagement>
30
```
31
32
### Gradle (Kotlin DSL)
33
34
```kotlin
35
dependencies {
36
implementation platform("io.micronaut:micronaut-core-bom:4.9.4")
37
}
38
```
39
40
### Gradle (Groovy DSL)
41
42
```groovy
43
dependencies {
44
implementation platform('io.micronaut:micronaut-core-bom:4.9.4')
45
}
46
```
47
48
### Gradle with Version Catalogs
49
50
```toml
51
# gradle/libs.versions.toml
52
[versions]
53
micronaut = "4.9.4"
54
55
[libraries]
56
micronaut-bom = { module = "io.micronaut:micronaut-core-bom", version.ref = "micronaut" }
57
58
# build.gradle.kts
59
dependencies {
60
implementation platform(libs.micronaut.bom)
61
}
62
```
63
64
## Basic Usage
65
66
```kotlin
67
// build.gradle.kts
68
dependencies {
69
// Import the BOM
70
implementation platform("io.micronaut:micronaut-core-bom:4.9.4")
71
72
// Now use Micronaut dependencies without version numbers
73
implementation("io.micronaut:micronaut-context")
74
implementation("io.micronaut:micronaut-http-server-netty")
75
implementation("io.micronaut:micronaut-jackson-databind")
76
77
// External dependencies are also managed
78
implementation("com.fasterxml.jackson.core:jackson-core")
79
implementation("io.netty:netty-handler")
80
implementation("org.jetbrains.kotlin:kotlin-stdlib")
81
}
82
```
83
84
## Capabilities
85
86
### Dependency Management
87
88
The BOM manages versions for all dependencies in the Micronaut ecosystem, ensuring compatibility and eliminating version conflicts. Once imported, all managed dependencies can be declared without explicit version numbers.
89
90
```xml { .api }
91
<!-- Maven: Import BOM in dependencyManagement -->
92
<dependencyManagement>
93
<dependencies>
94
<dependency>
95
<groupId>io.micronaut</groupId>
96
<artifactId>micronaut-core-bom</artifactId>
97
<version>4.9.4</version>
98
<type>pom</type>
99
<scope>import</scope>
100
</dependency>
101
</dependencies>
102
</dependencyManagement>
103
104
<!-- Then use managed dependencies without versions -->
105
<dependencies>
106
<dependency>
107
<groupId>io.micronaut</groupId>
108
<artifactId>micronaut-context</artifactId>
109
</dependency>
110
<dependency>
111
<groupId>io.micronaut</groupId>
112
<artifactId>micronaut-http-server-netty</artifactId>
113
</dependency>
114
</dependencies>
115
```
116
117
```kotlin { .api }
118
// Gradle Kotlin DSL: Import platform
119
dependencies {
120
implementation(platform("io.micronaut:micronaut-core-bom:4.9.4"))
121
122
// Use managed dependencies without versions
123
implementation("io.micronaut:micronaut-context")
124
implementation("io.micronaut:micronaut-http-server-netty")
125
}
126
```
127
128
### Micronaut Core Modules
129
130
The BOM manages versions for all Micronaut Core framework modules:
131
132
#### Core Framework Dependencies
133
134
```kotlin { .api }
135
// Core components
136
implementation("io.micronaut:micronaut-core") // Foundation classes and utilities
137
implementation("io.micronaut:micronaut-context") // Dependency injection container
138
implementation("io.micronaut:micronaut-inject") // DI framework
139
implementation("io.micronaut:micronaut-aop") // Aspect-oriented programming
140
implementation("io.micronaut:micronaut-runtime") // Runtime utilities
141
implementation("io.micronaut:micronaut-core-reactive") // Reactive programming support
142
```
143
144
#### HTTP Components
145
146
```kotlin { .api }
147
// HTTP server and client
148
implementation("io.micronaut:micronaut-http") // HTTP abstractions
149
implementation("io.micronaut:micronaut-http-server") // HTTP server
150
implementation("io.micronaut:micronaut-http-server-netty") // Netty HTTP server
151
implementation("io.micronaut:micronaut-http-client") // HTTP client
152
implementation("io.micronaut:micronaut-http-client-core") // Core HTTP client
153
implementation("io.micronaut:micronaut-http-client-jdk") // JDK HTTP client
154
implementation("io.micronaut:micronaut-http-validation") // HTTP validation
155
implementation("io.micronaut:micronaut-websocket") // WebSocket support
156
```
157
158
#### Language Support
159
160
```kotlin { .api }
161
// Java support
162
annotationProcessor("io.micronaut:micronaut-inject-java") // Java annotation processor
163
testImplementation("io.micronaut:micronaut-inject-java-test") // Java testing utilities
164
165
// Groovy support
166
implementation("io.micronaut:micronaut-inject-groovy") // Groovy DI support
167
testImplementation("io.micronaut:micronaut-inject-groovy-test") // Groovy testing
168
169
// Kotlin support
170
implementation("io.micronaut:micronaut-inject-kotlin") // Kotlin DI support
171
testImplementation("io.micronaut:micronaut-inject-kotlin-test") // Kotlin testing
172
```
173
174
#### Additional Features
175
176
```kotlin { .api }
177
// JSON processing
178
implementation("io.micronaut:micronaut-jackson-core") // Jackson integration
179
implementation("io.micronaut:micronaut-jackson-databind") // Jackson databinding
180
implementation("io.micronaut:micronaut-json-core") // JSON core
181
182
// Other features
183
implementation("io.micronaut:micronaut-messaging") // Messaging abstractions
184
implementation("io.micronaut:micronaut-router") // Request routing
185
implementation("io.micronaut:micronaut-management") // Management endpoints
186
implementation("io.micronaut:micronaut-retry") // Retry mechanisms
187
implementation("io.micronaut:micronaut-function") // Function support
188
implementation("io.micronaut:micronaut-function-client") // Function client
189
implementation("io.micronaut:micronaut-graal") // GraalVM support
190
implementation("io.micronaut:micronaut-discovery-core") // Service discovery
191
implementation("io.micronaut:micronaut-context-propagation") // Context propagation
192
implementation("io.micronaut:micronaut-buffer-netty") // Netty buffer integration
193
```
194
195
### External Dependencies
196
197
The BOM also manages versions for key external libraries used by Micronaut:
198
199
#### Jackson JSON Processing
200
201
```kotlin { .api }
202
// Jackson dependencies with managed versions
203
implementation("com.fasterxml.jackson.core:jackson-core") // 2.18.3
204
implementation("com.fasterxml.jackson.core:jackson-databind") // 2.18.2
205
implementation("com.fasterxml.jackson.core:jackson-annotations") // 2.18.3
206
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jdk8") // 2.18.3
207
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310") // 2.18.3
208
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml") // 2.18.3
209
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml") // 2.18.3
210
implementation("com.fasterxml.jackson.module:jackson-module-afterburner") // 2.18.3
211
implementation("com.fasterxml.jackson.module:jackson-module-kotlin") // 2.18.3
212
implementation("com.fasterxml.jackson.module:jackson-module-parameter-names") // 2.18.3
213
```
214
215
#### Netty Network Programming
216
217
```kotlin { .api }
218
// Netty dependencies with managed versions
219
implementation("io.netty:netty-buffer") // 4.2.2.Final
220
implementation("io.netty:netty-common") // 4.2.2.Final
221
implementation("io.netty:netty-codec-http") // 4.2.2.Final
222
implementation("io.netty:netty-codec-http2") // 4.2.2.Final
223
implementation("io.netty:netty-codec-http3") // 4.2.2.Final
224
implementation("io.netty:netty-handler") // 4.2.2.Final
225
implementation("io.netty:netty-handler-proxy") // 4.2.2.Final
226
implementation("io.netty:netty-transport-native-epoll") // 4.2.2.Final
227
implementation("io.netty:netty-transport-native-kqueue") // 4.2.2.Final
228
implementation("io.netty:netty-transport-native-io_uring") // 4.2.2.Final
229
implementation("io.netty:netty-transport-native-unix-common") // 4.2.2.Final
230
implementation("io.netty:netty-codec-classes-quic") // 4.2.2.Final
231
implementation("io.netty:netty-codec-native-quic") // 4.2.2.Final
232
implementation("io.netty:netty-tcnative-boringssl-static") // 2.0.72.Final
233
```
234
235
#### Kotlin Support
236
237
```kotlin { .api }
238
// Kotlin dependencies with managed versions
239
implementation("org.jetbrains.kotlin:kotlin-stdlib") // 1.9.25
240
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") // 1.9.25
241
implementation("org.jetbrains.kotlin:kotlin-reflect") // 1.9.25
242
implementation("org.jetbrains.kotlin:kotlin-test") // 1.9.25
243
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core") // 1.8.1
244
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8") // 1.8.1
245
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactive") // 1.8.1
246
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor") // 1.8.1
247
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-rx2") // 1.8.1
248
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-slf4j") // 1.8.1
249
250
// Kotlin compiler dependencies (for tooling and annotation processing)
251
implementation("org.jetbrains.kotlin:kotlin-annotation-processing-embeddable") // 1.9.25
252
implementation("org.jetbrains.kotlin:kotlin-compiler-embeddable") // 1.9.25
253
```
254
255
#### Groovy Support
256
257
```kotlin { .api }
258
// Groovy dependencies with managed versions
259
implementation("org.apache.groovy:groovy") // 4.0.27
260
implementation("org.apache.groovy:groovy-json") // 4.0.27
261
implementation("org.apache.groovy:groovy-sql") // 4.0.27
262
implementation("org.apache.groovy:groovy-templates") // 4.0.27
263
```
264
265
#### Jakarta/Javax APIs
266
267
```kotlin { .api }
268
// Jakarta/Javax API dependencies with managed versions
269
implementation("jakarta.annotation:jakarta.annotation-api") // 2.1.1
270
```
271
272
#### Reactive Programming
273
274
```kotlin { .api }
275
// Reactive dependencies with managed versions
276
implementation("org.reactivestreams:reactive-streams") // 1.0.4
277
implementation("io.projectreactor:reactor-core") // 3.7.7
278
testImplementation("io.projectreactor:reactor-test") // 3.7.7
279
```
280
281
#### Other Managed Dependencies
282
283
```kotlin { .api }
284
// Additional dependencies with managed versions
285
implementation("org.yaml:snakeyaml") // 2.4
286
implementation("io.methvin:directory-watcher") // 0.19.0
287
implementation("com.github.javaparser:javaparser-symbol-solver-core") // 3.26.4
288
implementation("com.google.devtools.ksp:symbol-processing-api") // 1.9.25-1.0.20
289
implementation("com.google.devtools.ksp:symbol-processing") // 1.9.25-1.0.20
290
```
291
292
### Version Override
293
294
While the BOM manages versions, you can override them when needed:
295
296
```kotlin { .api }
297
dependencies {
298
implementation(platform("io.micronaut:micronaut-core-bom:4.9.4"))
299
300
// Use BOM-managed version
301
implementation("com.fasterxml.jackson.core:jackson-core")
302
303
// Override with specific version
304
implementation("org.yaml:snakeyaml:2.3") {
305
version {
306
strictly("2.3") // Force specific version
307
}
308
}
309
}
310
```
311
312
```xml { .api }
313
<!-- Maven: Override BOM version -->
314
<dependencies>
315
<dependency>
316
<groupId>org.yaml</groupId>
317
<artifactId>snakeyaml</artifactId>
318
<version>2.3</version> <!-- Overrides BOM version -->
319
</dependency>
320
</dependencies>
321
```
322
323
## Types
324
325
### Maven Dependency Management Types
326
327
```xml { .api }
328
<!-- BOM import configuration -->
329
<dependencyManagement>
330
<dependencies>
331
<dependency>
332
<groupId>io.micronaut</groupId>
333
<artifactId>micronaut-core-bom</artifactId>
334
<version>4.9.4</version>
335
<type>pom</type> <!-- Always 'pom' for BOM imports -->
336
<scope>import</scope> <!-- Always 'import' for BOM imports -->
337
</dependency>
338
</dependencies>
339
</dependencyManagement>
340
```
341
342
### Gradle Platform Types
343
344
```kotlin { .api }
345
// Gradle platform configuration types
346
dependencies {
347
// Platform import - manages versions of dependencies
348
implementation(platform("io.micronaut:micronaut-core-bom:4.9.4"))
349
350
// Enforced platform - forces versions even when conflicts exist
351
implementation(enforcedPlatform("io.micronaut:micronaut-core-bom:4.9.4"))
352
}
353
354
// Configuration for test dependencies
355
testImplementation(platform("io.micronaut:micronaut-core-bom:4.9.4"))
356
```
357
358
### Gradle Version Catalog Types
359
360
```toml { .api }
361
# gradle/libs.versions.toml structure for BOM
362
[versions]
363
micronaut = "4.9.4"
364
365
[libraries]
366
# BOM library definition
367
micronaut-bom = { module = "io.micronaut:micronaut-core-bom", version.ref = "micronaut" }
368
369
# Managed dependencies (versions omitted - managed by BOM)
370
micronaut-context = { module = "io.micronaut:micronaut-context" }
371
micronaut-http-server = { module = "io.micronaut:micronaut-http-server-netty" }
372
jackson-core = { module = "com.fasterxml.jackson.core:jackson-core" }
373
```
374
375
## Usage Examples
376
377
### Complete Micronaut Application Setup
378
379
```kotlin
380
// build.gradle.kts
381
plugins {
382
application
383
kotlin("jvm")
384
kotlin("plugin.allopen")
385
}
386
387
dependencies {
388
// Import Micronaut BOM
389
implementation(platform("io.micronaut:micronaut-core-bom:4.9.4"))
390
391
// Core Micronaut dependencies
392
implementation("io.micronaut:micronaut-context")
393
implementation("io.micronaut:micronaut-runtime")
394
implementation("io.micronaut:micronaut-http-server-netty")
395
implementation("io.micronaut:micronaut-jackson-databind")
396
397
// Annotation processors
398
annotationProcessor("io.micronaut:micronaut-inject-java")
399
400
// All versions are managed by the BOM
401
}
402
```
403
404
### Maven Project Setup
405
406
```xml
407
<project>
408
<dependencyManagement>
409
<dependencies>
410
<!-- Import Micronaut BOM -->
411
<dependency>
412
<groupId>io.micronaut</groupId>
413
<artifactId>micronaut-core-bom</artifactId>
414
<version>4.9.4</version>
415
<type>pom</type>
416
<scope>import</scope>
417
</dependency>
418
</dependencies>
419
</dependencyManagement>
420
421
<dependencies>
422
<!-- Micronaut dependencies without versions -->
423
<dependency>
424
<groupId>io.micronaut</groupId>
425
<artifactId>micronaut-context</artifactId>
426
</dependency>
427
<dependency>
428
<groupId>io.micronaut</groupId>
429
<artifactId>micronaut-http-server-netty</artifactId>
430
</dependency>
431
<dependency>
432
<groupId>io.micronaut</groupId>
433
<artifactId>micronaut-jackson-databind</artifactId>
434
</dependency>
435
436
<!-- External dependencies are also managed -->
437
<dependency>
438
<groupId>com.fasterxml.jackson.core</groupId>
439
<artifactId>jackson-core</artifactId>
440
</dependency>
441
</dependencies>
442
</project>
443
```
444
445
### Multi-Module Project
446
447
```kotlin
448
// Parent build.gradle.kts
449
subprojects {
450
dependencies {
451
// Apply BOM to all subprojects
452
implementation(platform("io.micronaut:micronaut-core-bom:4.9.4"))
453
}
454
}
455
456
// Module-specific build.gradle.kts
457
dependencies {
458
// Versions managed by parent BOM
459
implementation("io.micronaut:micronaut-context")
460
implementation("io.micronaut:micronaut-http-client")
461
testImplementation("io.micronaut:micronaut-test-junit5")
462
}
463
464
## Common Issues and Error Handling
465
466
### Version Conflicts
467
468
When using the BOM, version conflicts may still occur if dependencies are overridden or forced:
469
470
```kotlin
471
dependencies {
472
implementation(platform("io.micronaut:micronaut-core-bom:4.9.4"))
473
474
// This may cause conflicts with BOM-managed versions
475
implementation("com.fasterxml.jackson.core:jackson-core:2.15.0") {
476
version {
477
strictly("2.15.0")
478
}
479
}
480
}
481
```
482
483
**Solution**: Remove version overrides or use BOM-managed versions when possible.
484
485
### Missing Platform Declaration
486
487
```kotlin
488
// ❌ Wrong - no platform declaration
489
dependencies {
490
implementation("io.micronaut:micronaut-context") // Version not managed
491
}
492
493
// ✅ Correct - with platform
494
dependencies {
495
implementation(platform("io.micronaut:micronaut-core-bom:4.9.4"))
496
implementation("io.micronaut:micronaut-context") // Version managed by BOM
497
}
498
```
499
500
### Maven Import Scope Issues
501
502
```xml
503
<!-- ❌ Wrong scope -->
504
<dependency>
505
<groupId>io.micronaut</groupId>
506
<artifactId>micronaut-core-bom</artifactId>
507
<version>4.9.4</version>
508
<type>pom</type>
509
<scope>compile</scope> <!-- Wrong scope -->
510
</dependency>
511
512
<!-- ✅ Correct - import scope in dependencyManagement -->
513
<dependencyManagement>
514
<dependencies>
515
<dependency>
516
<groupId>io.micronaut</groupId>
517
<artifactId>micronaut-core-bom</artifactId>
518
<version>4.9.4</version>
519
<type>pom</type>
520
<scope>import</scope>
521
</dependency>
522
</dependencies>
523
</dependencyManagement>
524
```