Commit 8c28a02
Add integration tests and fix default reconciliation merging
Addresses reviewer feedback on PR #389:
1. Add integration tests for default reconciliation behavior:
- Test with no executionControl configuration (uses defaults)
- Test with executionControl for different plugin (verifies merging)
2. Fix reconciliation config resolution to merge defaults with explicit config:
- Explicit configs take precedence when present
- Default reconciliation configs apply when no explicit config exists
- Ensures compiler defaults work even when other plugins are configured
3. Add null safety checks to prevent NPE in unit tests:
- Check for null mojoExecution before accessing
- Check for null plugin before matching
Integration tests verify that:
- Changing maven.compiler.release invalidates cache as expected
- Changing maven.compiler.source/target invalidates cache
- Default reconciliation still applies when executionControl configures other plugins
Add test for explicit config overriding defaults
Completes integration test coverage requested by reviewer:
1. ✅ No configuration set - DefaultReconciliationTest
2. ✅ No plugin configuration set - DefaultReconciliationTest
3. ✅ Plugin reconciliation overrides defaults - DefaultReconciliationOverrideTest (NEW)
4. ✅ Plugin reconciliation merges with defaults - DefaultReconciliationWithOtherPluginTest
The new test verifies that when executionControl explicitly configures
maven-compiler-plugin, the explicit config completely OVERRIDES the
defaults rather than merging:
- Explicit config tracks only 'release' property
- Changing 'source' DOES hit cache (proves 'source' not tracked)
- Changing 'release' does NOT hit cache (proves 'release' is tracked)
- If defaults merged, 'source' would also be tracked (but it's not)
This confirms the implementation correctly handles both override and
merge scenarios as requested.
Implement plugin parameter export/categorization system
Addresses reviewer suggestion to create extensible configuration system:
**Architecture:**
- Plugin parameter definitions stored as XML files in classpath
- Each plugin has its own XML file (e.g., maven-compiler-plugin.xml)
- Parameters categorized as "functional" or "behavioral"
- Validation system checks reconciliation configs against definitions
**Components:**
1. **XML Schema** (plugin-parameters.xsd):
- Defines structure for parameter definitions
- Enforces functional/behavioral categorization
- Validates at build time
2. **Parameter Definitions**:
- maven-compiler-plugin.xml: 30+ parameters for compile/testCompile goals
- maven-install-plugin.xml: 12+ parameters for install/install-file goals
- Comprehensive categorization based on whether parameter affects output
3. **Java Infrastructure**:
- PluginParameterDefinition: Model classes for definitions
- PluginParameterLoader: Loads XML from classpath
- Validation logic in CacheConfigImpl
4. **Validation Features**:
- ERROR on unknown parameters (may indicate plugin changes)
- WARN on behavioral parameters in reconciliation config
- WARN when no definition exists for plugin
- Validates all default reconciliation configs on initialization
**Benefits:**
- Detects plugin parameter changes/renames automatically
- Prevents incorrect behavioral parameters in reconciliation
- Self-documenting: XML files serve as parameter catalog
- Extensible: Add new plugins by creating XML files
- Type-safe: Enforces functional/behavioral distinction
**Testing:**
- Unit tests verify parameter loading and categorization
- Validates that default reconciliation params are functional
- All 20 existing tests pass + 3 new validation tests
This creates a "closed and matching set of parameters" as requested,
ensuring the default configuration fails/warns on unknown parameters
and preventing incorrect behavior from plugin modifications.
Add user documentation for parameter validation system
Updates documentation to explain the new parameter categorization and
validation features:
**how-to.md additions:**
- New "Parameter Validation and Categorization" section
- Explains functional vs behavioral parameter categories
- Documents validation features (ERROR/WARN on unknown/misclassified params)
- Provides example XML for adding new plugin definitions
- Notes that defaults are overridden by explicit config per-plugin
- Lists current coverage (maven-compiler-plugin, maven-install-plugin)
**concepts.md additions:**
- Reference to parameter validation system
- Link to detailed how-to documentation
- Context within correctness vs performance tradeoff discussion
This documentation will appear on the Maven website, making the feature
discoverable and providing clear guidance for:
- Understanding why certain parameters are tracked
- Adding validation for new plugins
- Troubleshooting unknown parameter warnings
- Extending the system as plugins evolve
Fix integration test version placeholder
Use ${projectVersion} instead of @project.version@ to match the resource filtering pattern used by other integration tests.
Fix integration tests to check for reconciliation behavior
- Fix XML config structure: executionControl is sibling of configuration, not child
- Update test assertions to check for 'Plugin parameter mismatch found' message
- Reconciliation happens at runtime after cache lookup, not during hash calculation
- Tests now correctly verify that parameter changes trigger rebuild via reconciliation
Add version-specific parameter definition support
- Update XSD schema to support minVersion element
- Implement version-aware parameter loading with best-match selection
- Add version comparison logic handling SNAPSHOT qualifiers
- Update validation to use plugin version at runtime
- Add comprehensive tests for version-specific loading
- Update documentation with version support examples
Version matching selects the definition with highest minVersion <= plugin version.
Multiple version-specific definitions can coexist in a single XML file.
This allows accurate validation as plugin APIs evolve across versions.
Load default reconciliation configs from XML instead of hardcoding
- Create default-reconciliation.xsd schema for defaults
- Add defaults.xml with maven-compiler-plugin and maven-install-plugin configs
- Implement DefaultReconciliationLoader to load configs from XML
- Replace hardcoded defaults in CacheConfigImpl with XML loading
- Update documentation to reflect XML-based configuration
This makes defaults extensible - projects can provide their own
default-reconciliation/defaults.xml on the classpath.1 parent e99c008 commit 8c28a02
File tree
27 files changed
+2317
-51
lines changed- src
- main
- java/org/apache/maven/buildcache/xml
- resources
- default-reconciliation
- plugin-parameters
- site/markdown
- test
- java/org/apache/maven/buildcache
- its
- xml
- projects
- default-reconciliation-override
- .mvn
- src/main/java/org/apache/maven/buildcache
- default-reconciliation-with-other-plugin
- .mvn
- src/main/java/org/apache/maven/buildcache
- default-reconciliation
- .mvn
- src/main/java/org/apache/maven/buildcache
- resources/plugin-parameters
27 files changed
+2317
-51
lines changedLines changed: 170 additions & 50 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| 121 | + | |
| 122 | + | |
121 | 123 | | |
122 | 124 | | |
123 | 125 | | |
| |||
129 | 131 | | |
130 | 132 | | |
131 | 133 | | |
| 134 | + | |
| 135 | + | |
132 | 136 | | |
133 | 137 | | |
134 | 138 | | |
| |||
248 | 252 | | |
249 | 253 | | |
250 | 254 | | |
251 | | - | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
252 | 258 | | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
258 | 264 | | |
259 | 265 | | |
260 | | - | |
261 | | - | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
262 | 278 | | |
263 | | - | |
264 | | - | |
265 | | - | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
266 | 286 | | |
267 | 287 | | |
| 288 | + | |
268 | 289 | | |
269 | 290 | | |
270 | 291 | | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
286 | 315 | | |
287 | | - | |
288 | | - | |
289 | | - | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
290 | 327 | | |
291 | | - | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
292 | 333 | | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
297 | 360 | | |
298 | | - | |
299 | | - | |
300 | | - | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
301 | 367 | | |
302 | | - | |
303 | | - | |
304 | | - | |
| 368 | + | |
| 369 | + | |
305 | 370 | | |
306 | | - | |
307 | | - | |
308 | | - | |
| 371 | + | |
| 372 | + | |
309 | 373 | | |
310 | | - | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
311 | 396 | | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
317 | 407 | | |
318 | | - | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
319 | 439 | | |
320 | 440 | | |
321 | 441 | | |
| |||
Lines changed: 126 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
0 commit comments