Commit 014b2cc
committed
[MNG-5102] Add support for POM mixins
Maven 4.1.0 introduces POM Mixins, a powerful new feature that enables more
flexible and modular project composition. Mixins allow extracting common
configurations into reusable components that can be included in projects,
promoting better organization and reducing duplication across build configurations.
Key Features:
- Modular composition: Extract common configurations into reusable components
- Multiple inclusion methods: Include mixins by relative path or GAV coordinates
- Classifier support: Reference specialized configurations with classifiers
- No inheritance constraints: Unlike parent POMs, mixins allow composition from multiple sources
Usage Examples:
- Path-based: <relativePath>mixins/mixin-1.xml</relativePath>
- GAV-based: <groupId>org.example</groupId><artifactId>my-mixin</artifactId><version>1.0.0</version>
- With classifier: <classifier>special</classifier>
Implementation Details:
- Introduces modelVersion 4.2.0 to support mixins functionality
- Extends Maven model with new <mixins> element containing <mixin> declarations
- Integrates mixin resolution and merging into model building process
- Maintains well-defined merging rules similar to parent POM processing
- Includes comprehensive integration tests for all usage scenarios
Technical Changes:
- Added MODEL_VERSION_4_2_0 constant and updated VALID_MODEL_VERSIONS
- Enhanced DefaultModelBuilder with mixin processing logic
- Updated model schema (maven.mdo) to include mixins elements
- Added POM schema files for model version 4.2.0
- Integrated mixin inheritance assembly and validation
- Added comprehensive test suite covering path, GAV, and classifier scenarios
Compatibility:
- Requires Maven 4.1.0+ and modelVersion 4.2.0 or higher
- Backward compatible with existing POM structures
- Consumer POMs properly handle mixin elements for downstream compatibility
Resolves: https://issues.apache.org/jira/browse/MNG-51021 parent 5c10323 commit 014b2cc
File tree
21 files changed
+710
-256
lines changed- api/maven-api-model/src/main/mdo
- compat/maven-model-builder/src/main/java/org/apache/maven/model/building
- impl
- maven-core/src/main/java/org/apache/maven/internal/transformation/impl
- maven-impl/src/main/java/org/apache/maven
- api/services/model
- impl
- model
- resolver
- its/core-it-suite/src/test
- java/org/apache/maven/it
- resources/mng-5102-mixins
- classifier
- mixin-4
- project
- gav
- mixin-2
- project
- path
- child
- src/main/resources
- mixins
21 files changed
+710
-256
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
114 | 128 | | |
115 | 129 | | |
116 | 130 | | |
| |||
1836 | 1850 | | |
1837 | 1851 | | |
1838 | 1852 | | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
| 1856 | + | |
| 1857 | + | |
| 1858 | + | |
| 1859 | + | |
| 1860 | + | |
| 1861 | + | |
| 1862 | + | |
| 1863 | + | |
| 1864 | + | |
| 1865 | + | |
| 1866 | + | |
| 1867 | + | |
| 1868 | + | |
| 1869 | + | |
1839 | 1870 | | |
1840 | 1871 | | |
1841 | 1872 | | |
| |||
compat/maven-model-builder/src/main/java/org/apache/maven/model/building/FileToRawModelMerger.java
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
141 | 147 | | |
142 | 148 | | |
143 | 149 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
| 212 | + | |
212 | 213 | | |
213 | 214 | | |
214 | 215 | | |
| |||
Lines changed: 13 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
| 89 | + | |
89 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
90 | 98 | | |
91 | 99 | | |
92 | 100 | | |
| |||
106 | 114 | | |
107 | 115 | | |
108 | 116 | | |
109 | | - | |
| 117 | + | |
| 118 | + | |
110 | 119 | | |
111 | 120 | | |
112 | 121 | | |
113 | 122 | | |
114 | | - | |
| 123 | + | |
115 | 124 | | |
116 | 125 | | |
117 | 126 | | |
| |||
123 | 132 | | |
124 | 133 | | |
125 | 134 | | |
| 135 | + | |
126 | 136 | | |
127 | 137 | | |
128 | 138 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
197 | 207 | | |
198 | 208 | | |
199 | 209 | | |
| |||
Lines changed: 63 additions & 31 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| |||
838 | 839 | | |
839 | 840 | | |
840 | 841 | | |
841 | | - | |
| 842 | + | |
842 | 843 | | |
843 | 844 | | |
844 | | - | |
845 | 845 | | |
846 | | - | |
| 846 | + | |
847 | 847 | | |
848 | 848 | | |
849 | 849 | | |
| |||
868 | 868 | | |
869 | 869 | | |
870 | 870 | | |
871 | | - | |
| 871 | + | |
| 872 | + | |
872 | 873 | | |
873 | 874 | | |
874 | 875 | | |
875 | | - | |
| 876 | + | |
876 | 877 | | |
877 | 878 | | |
878 | | - | |
| 879 | + | |
879 | 880 | | |
880 | 881 | | |
881 | 882 | | |
882 | 883 | | |
883 | | - | |
| 884 | + | |
| 885 | + | |
884 | 886 | | |
885 | 887 | | |
886 | 888 | | |
887 | | - | |
| 889 | + | |
| 890 | + | |
888 | 891 | | |
889 | 892 | | |
890 | 893 | | |
| |||
893 | 896 | | |
894 | 897 | | |
895 | 898 | | |
896 | | - | |
| 899 | + | |
897 | 900 | | |
898 | 901 | | |
899 | 902 | | |
900 | 903 | | |
901 | 904 | | |
| 905 | + | |
| 906 | + | |
902 | 907 | | |
903 | | - | |
| 908 | + | |
904 | 909 | | |
905 | 910 | | |
906 | 911 | | |
| |||
910 | 915 | | |
911 | 916 | | |
912 | 917 | | |
| 918 | + | |
| 919 | + | |
913 | 920 | | |
914 | 921 | | |
915 | 922 | | |
| |||
925 | 932 | | |
926 | 933 | | |
927 | 934 | | |
928 | | - | |
929 | | - | |
930 | | - | |
931 | | - | |
932 | | - | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
933 | 939 | | |
934 | 940 | | |
935 | 941 | | |
| |||
968 | 974 | | |
969 | 975 | | |
970 | 976 | | |
971 | | - | |
972 | | - | |
| 977 | + | |
973 | 978 | | |
974 | 979 | | |
975 | 980 | | |
| |||
1000 | 1005 | | |
1001 | 1006 | | |
1002 | 1007 | | |
1003 | | - | |
| 1008 | + | |
| 1009 | + | |
1004 | 1010 | | |
1005 | 1011 | | |
1006 | 1012 | | |
1007 | 1013 | | |
1008 | | - | |
1009 | | - | |
1010 | 1014 | | |
1011 | 1015 | | |
1012 | 1016 | | |
| 1017 | + | |
| 1018 | + | |
1013 | 1019 | | |
1014 | 1020 | | |
1015 | 1021 | | |
| |||
1027 | 1033 | | |
1028 | 1034 | | |
1029 | 1035 | | |
1030 | | - | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
1031 | 1039 | | |
1032 | | - | |
1033 | | - | |
1034 | | - | |
1035 | | - | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
1036 | 1053 | | |
1037 | 1054 | | |
1038 | 1055 | | |
| |||
1148 | 1165 | | |
1149 | 1166 | | |
1150 | 1167 | | |
1151 | | - | |
| 1168 | + | |
| 1169 | + | |
1152 | 1170 | | |
1153 | 1171 | | |
1154 | 1172 | | |
| |||
1170 | 1188 | | |
1171 | 1189 | | |
1172 | 1190 | | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
1173 | 1200 | | |
1174 | 1201 | | |
1175 | 1202 | | |
| |||
1354 | 1381 | | |
1355 | 1382 | | |
1356 | 1383 | | |
1357 | | - | |
| 1384 | + | |
1358 | 1385 | | |
1359 | 1386 | | |
1360 | 1387 | | |
| |||
1575 | 1602 | | |
1576 | 1603 | | |
1577 | 1604 | | |
1578 | | - | |
1579 | | - | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
1580 | 1608 | | |
1581 | 1609 | | |
1582 | 1610 | | |
| |||
1592 | 1620 | | |
1593 | 1621 | | |
1594 | 1622 | | |
1595 | | - | |
1596 | | - | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
1597 | 1629 | | |
1598 | 1630 | | |
1599 | 1631 | | |
| |||
Lines changed: 37 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
355 | 355 | | |
356 | 356 | | |
357 | 357 | | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
358 | 395 | | |
359 | 396 | | |
360 | 397 | | |
| |||
0 commit comments