Commit f84bcc9
fix(maven-plugin): a relative <sourceDir> resolved against the shell's working directory, not the module
AbstractMetaDataMojo.getSourceDir() did new File(<sourceDir>), which resolves
against the JVM's working directory. Maven keeps the reactor root as the working
directory for every module, so the documented
<sourceDir>src/main/metaobjects</sourceDir> failed "SourceDir [...] does not
exist" in any multi-module build run from the parent, and under
mvn -f <module>/pom.xml. A relative <sourceDir> now resolves against
${project.basedir}, as every relative path in a pom does; an absolute one is
unchanged. The resolved path is what reaches the loader, so <sources> entries
under it resolve correctly too.
The plugin's own test had recorded the old behavior in a comment ("paths here
are ABSOLUTE on purpose") instead of fixing it. New test pins the relative case
(red before, green after); maven-plugin suite 46/0. Found building an adopter
estate's Java port with mvn -f from its root; that build now passes.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 5825f05 commit f84bcc9
3 files changed
Lines changed: 45 additions & 5 deletions
File tree
- server/java/maven-plugin/src
- main/java/com/metaobjects/mojo
- test/java/com/metaobjects/mojo
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
295 | 304 | | |
296 | 305 | | |
297 | 306 | | |
| |||
Lines changed: 12 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
278 | 278 | | |
279 | 279 | | |
280 | 280 | | |
281 | | - | |
| 281 | + | |
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
| |||
532 | 532 | | |
533 | 533 | | |
534 | 534 | | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
535 | 542 | | |
536 | 543 | | |
537 | 544 | | |
538 | 545 | | |
539 | | - | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
540 | 550 | | |
541 | 551 | | |
542 | 552 | | |
| |||
Lines changed: 24 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
43 | | - | |
44 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
| |||
93 | 95 | | |
94 | 96 | | |
95 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
96 | 117 | | |
97 | 118 | | |
98 | 119 | | |
| |||
0 commit comments