|
171 | 171 | </execution> |
172 | 172 | </executions> |
173 | 173 | </plugin> |
| 174 | + <plugin> |
| 175 | + <artifactId>maven-clean-plugin</artifactId> |
| 176 | + <executions> |
| 177 | + <!-- |
| 178 | + Remove src after use. This is for tidyness but not correctness. |
| 179 | + SOMETHING in maven allows the sources jar to be built during the package phase |
| 180 | + even though they've been deleted as early as the process-resources phase |
| 181 | + while still allowing us to avoid the shade "define overlapping classes" warning. |
| 182 | + --> |
| 183 | + <execution> |
| 184 | + <id>clean-client-shade-workaround-source-post</id> |
| 185 | + <phase>process-resources</phase> |
| 186 | + <goals> |
| 187 | + <goal>clean</goal> |
| 188 | + </goals> |
| 189 | + <configuration> |
| 190 | + <excludeDefaultDirectories>true</excludeDefaultDirectories> |
| 191 | + <verbose>true</verbose> |
| 192 | + <filesets> |
| 193 | + <fileset> |
| 194 | + <directory>src</directory> |
| 195 | + </fileset> |
| 196 | + </filesets> |
| 197 | + </configuration> |
| 198 | + </execution> |
| 199 | + <!-- |
| 200 | + Ensure that src is *always* |
| 201 | + removed before a compile phase runs. This is |
| 202 | + for correctness. |
| 203 | + --> |
| 204 | + <execution> |
| 205 | + <id>clean-client-shade-workaround-source-pre</id> |
| 206 | + <phase>deploy</phase> |
| 207 | + <goals> |
| 208 | + <goal>clean</goal> |
| 209 | + </goals> |
| 210 | + <configuration> |
| 211 | + <excludeDefaultDirectories>true</excludeDefaultDirectories> |
| 212 | + <verbose>true</verbose> |
| 213 | + <filesets> |
| 214 | + <fileset> |
| 215 | + <directory>src</directory> |
| 216 | + </fileset> |
| 217 | + </filesets> |
| 218 | + </configuration> |
| 219 | + </execution> |
| 220 | + </executions> |
| 221 | + </plugin> |
174 | 222 | </plugins> |
175 | 223 | </build> |
| 224 | + |
| 225 | + <profiles> |
| 226 | + <profile> |
| 227 | + <id>release</id> |
| 228 | + <build> |
| 229 | + <plugins> |
| 230 | + |
| 231 | + <plugin> |
| 232 | + <artifactId>maven-resources-plugin</artifactId> |
| 233 | + <version>${maven-maven-resources-plugin.version}</version> |
| 234 | + <executions> |
| 235 | + <execution> |
| 236 | + <id>copy-shade-source-workaround-src</id> |
| 237 | + <phase>generate-sources</phase> |
| 238 | + <goals> |
| 239 | + <goal>copy-resources</goal> |
| 240 | + </goals> |
| 241 | + </execution> |
| 242 | + </executions> |
| 243 | + <configuration> |
| 244 | + <outputDirectory>src/shade-source-workaround</outputDirectory> |
| 245 | + <resources> |
| 246 | + <resource> |
| 247 | + <directory>${multi.module.root}/java-manta-client-unshaded/src/main/java</directory> |
| 248 | + </resource> |
| 249 | + </resources> |
| 250 | + </configuration> |
| 251 | + </plugin> |
| 252 | + |
| 253 | + <plugin> |
| 254 | + <groupId>org.codehaus.mojo</groupId> |
| 255 | + <artifactId>build-helper-maven-plugin</artifactId> |
| 256 | + <version>${maven-build-helper-maven-plugin.version}</version> |
| 257 | + <executions> |
| 258 | + <execution> |
| 259 | + <id>add-shade-source-workaround-src</id> |
| 260 | + <phase>process-sources</phase> |
| 261 | + <goals> |
| 262 | + <goal>add-source</goal> |
| 263 | + </goals> |
| 264 | + <configuration> |
| 265 | + <sources> |
| 266 | + <source>${project.basedir}/src/shade-source-workaround</source> |
| 267 | + </sources> |
| 268 | + </configuration> |
| 269 | + </execution> |
| 270 | + </executions> |
| 271 | + </plugin> |
| 272 | + |
| 273 | + <!-- |
| 274 | + For SOME reason Maven can build a sources JAR for this module based on the above workaround |
| 275 | + *and still* deleting the source files during process-resources in order to avoid the shade plugin |
| 276 | + detecting overlapping classes. |
| 277 | + --> |
| 278 | + </plugins> |
| 279 | + </build> |
| 280 | + </profile> |
| 281 | + </profiles> |
176 | 282 | </project> |
0 commit comments