|
57 | 57 | <properties> |
58 | 58 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
59 | 59 |
|
60 | | - <maven.compiler.release>21</maven.compiler.release> |
| 60 | + <!-- The main artifact is Java 11 so it loads on every supported runtime; the |
| 61 | + jdk21 classifier below is the same source compiled at 21. See the jdk21 |
| 62 | + executions in build/plugins. --> |
| 63 | + <maven.compiler.release>11</maven.compiler.release> |
| 64 | + <jdk21.release>21</jdk21.release> |
61 | 65 |
|
62 | 66 | <jacoco.version>0.8.12</jacoco.version> |
63 | 67 | <!-- jacoco:prepare-agent overwrites this at build time with the -javaagent setting. |
|
133 | 137 | </execution> |
134 | 138 | </executions> |
135 | 139 | </plugin> |
| 140 | + <!-- Two artifacts from one source tree. default-compile emits Java 11 into |
| 141 | + target/classes for the main jar; compile-jdk21 emits Java 21 into |
| 142 | + target/classes-jdk21 for the jdk21 classifier. The resource copy is |
| 143 | + needed because maven-jar-plugin takes a single classesDirectory, and |
| 144 | + that directory holds only .class files, so without it the classified |
| 145 | + jar would ship without cfml.dictionary's XML. |
| 146 | +
|
| 147 | + The copy must stay at process-classes and not move later. Setting |
| 148 | + outputDirectory on a compiler execution leaks into what the reactor |
| 149 | + hands dependent modules, so cfml.parsing's tests resolve |
| 150 | + cfml.dictionary to classes-jdk21. Copy the resources after the tests |
| 151 | + run and all 326 fail with "Problem loading dictionaryconfig.xml", |
| 152 | + which reads like a missing resource rather than a phase ordering |
| 153 | + problem. --> |
| 154 | + <plugin> |
| 155 | + <groupId>org.apache.maven.plugins</groupId> |
| 156 | + <artifactId>maven-compiler-plugin</artifactId> |
| 157 | + <version>3.13.0</version> |
| 158 | + <executions> |
| 159 | + <execution> |
| 160 | + <id>compile-jdk21</id> |
| 161 | + <phase>compile</phase> |
| 162 | + <goals> |
| 163 | + <goal>compile</goal> |
| 164 | + </goals> |
| 165 | + <configuration> |
| 166 | + <release>${jdk21.release}</release> |
| 167 | + <outputDirectory>${project.build.directory}/classes-jdk21</outputDirectory> |
| 168 | + </configuration> |
| 169 | + </execution> |
| 170 | + </executions> |
| 171 | + </plugin> |
| 172 | + <plugin> |
| 173 | + <groupId>org.apache.maven.plugins</groupId> |
| 174 | + <artifactId>maven-resources-plugin</artifactId> |
| 175 | + <version>3.3.1</version> |
| 176 | + <executions> |
| 177 | + <execution> |
| 178 | + <id>copy-resources-jdk21</id> |
| 179 | + <phase>process-classes</phase> |
| 180 | + <goals> |
| 181 | + <goal>copy-resources</goal> |
| 182 | + </goals> |
| 183 | + <configuration> |
| 184 | + <outputDirectory>${project.build.directory}/classes-jdk21</outputDirectory> |
| 185 | + <resources> |
| 186 | + <resource> |
| 187 | + <directory>${project.build.outputDirectory}</directory> |
| 188 | + <excludes> |
| 189 | + <exclude>**/*.class</exclude> |
| 190 | + </excludes> |
| 191 | + </resource> |
| 192 | + </resources> |
| 193 | + </configuration> |
| 194 | + </execution> |
| 195 | + </executions> |
| 196 | + </plugin> |
| 197 | + <plugin> |
| 198 | + <groupId>org.apache.maven.plugins</groupId> |
| 199 | + <artifactId>maven-jar-plugin</artifactId> |
| 200 | + <version>3.4.1</version> |
| 201 | + <executions> |
| 202 | + <execution> |
| 203 | + <id>jar-jdk21</id> |
| 204 | + <phase>package</phase> |
| 205 | + <goals> |
| 206 | + <goal>jar</goal> |
| 207 | + </goals> |
| 208 | + <configuration> |
| 209 | + <classifier>jdk21</classifier> |
| 210 | + <classesDirectory>${project.build.directory}/classes-jdk21</classesDirectory> |
| 211 | + <!-- The parent is pom-packaged and compiles nothing, so its |
| 212 | + classes-jdk21 is empty. Without this it still emits and |
| 213 | + deploys a spurious cfparser-VERSION-jdk21.jar. --> |
| 214 | + <skipIfEmpty>true</skipIfEmpty> |
| 215 | + </configuration> |
| 216 | + </execution> |
| 217 | + </executions> |
| 218 | + </plugin> |
136 | 219 | <plugin> |
137 | 220 | <groupId>org.jacoco</groupId> |
138 | 221 | <artifactId>jacoco-maven-plugin</artifactId> |
|
0 commit comments