Skip to content

Commit e7c4a7b

Browse files
authored
Effective POM Resolution Refactor (#187)
1 parent 33203f9 commit e7c4a7b

32 files changed

Lines changed: 8144 additions & 95 deletions

File tree

.github/workflows/build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010
branches:
1111
- 'main'
1212

13+
# Opt into Node.js 24 for actions (required for actions using Node 20 after deprecation)
14+
env:
15+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
16+
1317
jobs:
1418
Build:
1519
uses: avioconsulting/shared-workflows/.github/workflows/gradle-build.yml@main

.settings/org.eclipse.buildship.core.prefs

Lines changed: 0 additions & 13 deletions
This file was deleted.

AGENTS.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,38 @@ Examples:
160160
- `mule-linter-maven-plugin`: Maven-facing wrapper; keep it thin and compatible with Maven conventions.
161161
- `mule-linter-cli`: command-line packaging and distribution.
162162

163+
## Parent POM Resolution
164+
165+
Parent POMs are resolved using embedded Maven Resolver (Eclipse Aether):
166+
- Resolves full parent chain (child → parent → grandparent → ...)
167+
- Uses ~/.m2/settings.xml for repository configuration and authentication
168+
- Caches resolved parents in ~/.m2/repository (standard Maven cache)
169+
- Only resolves parent POMs (not dependencies or plugins)
170+
171+
**New Resolution Methods:**
172+
- `PomFile.resolveProperty(String)` - Returns ResolvedProperty with source tracking
173+
- `PomFile.resolveDependency(String, String)` - Returns ResolvedDependency with inheritance info
174+
- `PomFile.resolvePlugin(String, String)` - Returns ResolvedPlugin with management info
175+
176+
**Backward Compatibility:**
177+
- Existing methods (`getPomProperty()`, `getDependency()`, `getPlugin()`) still work
178+
- Parent resolution is explicit - call `pomFile.resolveParents(ParentPomResolver.getInstance())` to enable inheritance
179+
- `PomFile.resolveParents()` throws `ParentPomResolutionException` on failure (fail-fast)
180+
- `MuleApplication` catches resolution exceptions and logs warnings, allowing rules to operate on raw POM data
181+
182+
**Resolver Architecture:**
183+
- `ParentPomResolver.getInstance()` returns a shared singleton instance
184+
- The singleton is initialized lazily on first use (~500ms startup cost)
185+
- A JVM shutdown hook automatically calls `close()` on the singleton to release resources
186+
- Do NOT call `close()` on the singleton instance from application code
187+
- For tests or custom scenarios, use `new ParentPomResolver(path)` and manage lifecycle yourself
188+
189+
**System Properties:
190+
- `mule.linter.localRepo`: Custom local repository path (default: ~/.m2/repository)
191+
192+
**Environment:**
193+
- `M2_HOME`: Used to find global settings.xml
194+
163195
## Consolidated POM Test Structure
164196

165197
The `mule-linter-core` module has consolidated POM-related tests into 4 comprehensive test classes:

0 commit comments

Comments
 (0)