|
145 | 145 | <errorRemedy>failFast</errorRemedy> |
146 | 146 | <writeVersions>false</writeVersions> |
147 | 147 | <socketTimeout>20000</socketTimeout> |
148 | | - <licensesOutputDirectory>${project.basedir}/src/main/resources/licenses/THIRD_PARTY_LICENSES</licensesOutputDirectory> |
| 148 | + <licensesOutputDirectory>${project.build.directory}/temp-licenses/THIRD_PARTY_LICENSES</licensesOutputDirectory> |
149 | 149 | <licensesOutputFile>${project.build.directory}/licenses.xml</licensesOutputFile> |
150 | 150 | <organizeLicensesByDependencies>true</organizeLicensesByDependencies> |
151 | 151 | <excludedGroups>com.sonarsource|org.sonarsource.python|org.sonarsource.analyzer-commons|org.sonarsource.sslr|jaxen</excludedGroups> |
|
208 | 208 | </includes> |
209 | 209 | </resource> |
210 | 210 | </resources> |
211 | | - <outputDirectory>${project.basedir}/src/main/resources/licenses</outputDirectory> |
| 211 | + <outputDirectory>${project.build.directory}/temp-licenses</outputDirectory> |
212 | 212 | </configuration> |
213 | 213 | </execution> |
214 | 214 | </executions> |
215 | 215 | </plugin> |
216 | 216 |
|
217 | 217 | <plugin> |
218 | | - <artifactId>maven-antrun-plugin</artifactId> |
219 | | - <version>3.1.0</version> |
| 218 | + <groupId>org.codehaus.mojo</groupId> |
| 219 | + <artifactId>exec-maven-plugin</artifactId> |
| 220 | + <version>3.5.1</version> |
220 | 221 | <executions> |
221 | 222 | <execution> |
222 | | - <id>check-license-files</id> |
| 223 | + <id>validate-license-files</id> |
223 | 224 | <phase>verify</phase> |
224 | | - <configuration> |
225 | | - <target> |
226 | | - <fileset id="invalid.files" dir="${project.basedir}/src/main/resources/licenses"> |
227 | | - <exclude name="**/*.txt"/> |
228 | | - <include name="**/*"/> |
229 | | - </fileset> |
230 | | - <condition property="has.invalid.files"> |
231 | | - <resourcecount refid="invalid.files" when="greater" count="0"/> |
232 | | - </condition> |
233 | | - <fail message="There are files in ${project.build.directory}/licenses/ that do not end with .txt"> |
234 | | - <condition> |
235 | | - <isset property="has.invalid.files"/> |
236 | | - </condition> |
237 | | - </fail> |
238 | | - </target> |
239 | | - </configuration> |
240 | 225 | <goals> |
241 | | - <goal>run</goal> |
| 226 | + <goal>exec</goal> |
242 | 227 | </goals> |
| 228 | + <configuration> |
| 229 | + <skip>${skipLicenseValidation}</skip> |
| 230 | + <executable>python</executable> |
| 231 | + <arguments> |
| 232 | + <argument>${project.basedir}/../tools/validate_licenses.py</argument> |
| 233 | + <argument>--temp_licenses=${project.build.directory}/temp-licenses</argument> |
| 234 | + <argument>--committed_licenses=${project.basedir}/src/main/resources/licenses</argument> |
| 235 | + </arguments> |
| 236 | + <useMavenLogger>true</useMavenLogger> |
| 237 | + </configuration> |
243 | 238 | </execution> |
244 | 239 | </executions> |
245 | 240 | </plugin> |
246 | 241 |
|
247 | | - <plugin> |
248 | | - <groupId>org.codehaus.mojo</groupId> |
249 | | - <artifactId>build-helper-maven-plugin</artifactId> |
250 | | - <version>3.6.0</version> <executions> |
251 | | - <execution> |
252 | | - <id>add-resource</id> |
253 | | - <phase>generate-resources</phase> |
254 | | - <goals> |
255 | | - <goal>add-resource</goal> |
256 | | - </goals> |
257 | | - <configuration> |
258 | | - <resources> |
259 | | - <resource> |
260 | | - <directory>${project.build.directory}/generated-resources</directory> |
261 | | - </resource> |
262 | | - </resources> |
263 | | - </configuration> |
264 | | - </execution> |
265 | | - </executions> |
266 | | - </plugin> |
267 | | - |
268 | 242 | <plugin> |
269 | 243 | <artifactId>maven-shade-plugin</artifactId> |
270 | 244 | <executions> |
|
329 | 303 | </plugins> |
330 | 304 | </build> |
331 | 305 |
|
| 306 | + <profiles> |
| 307 | + <profile> |
| 308 | + <id>updateLicenses</id> |
| 309 | + <build> |
| 310 | + <plugins> |
| 311 | + <!-- Clean existing licenses before regenerating --> |
| 312 | + <plugin> |
| 313 | + <artifactId>maven-antrun-plugin</artifactId> |
| 314 | + <version>3.1.0</version> |
| 315 | + <executions> |
| 316 | + <!-- Clean licenses directory first --> |
| 317 | + <execution> |
| 318 | + <id>clean-licenses</id> |
| 319 | + <phase>initialize</phase> |
| 320 | + <configuration> |
| 321 | + <target> |
| 322 | + <echo message="Cleaning existing license files before regeneration..."/> |
| 323 | + <delete dir="${project.basedir}/src/main/resources/licenses" failonerror="false"/> |
| 324 | + <mkdir dir="${project.basedir}/src/main/resources/licenses"/> |
| 325 | + </target> |
| 326 | + </configuration> |
| 327 | + <goals> |
| 328 | + <goal>run</goal> |
| 329 | + </goals> |
| 330 | + </execution> |
| 331 | + </executions> |
| 332 | + </plugin> |
| 333 | + |
| 334 | + <!-- Disable license validation when updating --> |
| 335 | + <plugin> |
| 336 | + <groupId>org.codehaus.mojo</groupId> |
| 337 | + <artifactId>exec-maven-plugin</artifactId> |
| 338 | + <executions> |
| 339 | + <execution> |
| 340 | + <id>validate-license-files</id> |
| 341 | + <phase>none</phase> |
| 342 | + </execution> |
| 343 | + </executions> |
| 344 | + </plugin> |
| 345 | + |
| 346 | + <!-- Override license-maven-plugin to write to actual resource directory --> |
| 347 | + <plugin> |
| 348 | + <groupId>org.codehaus.mojo</groupId> |
| 349 | + <artifactId>license-maven-plugin</artifactId> |
| 350 | + <configuration> |
| 351 | + <!-- Override to write directly to resources when updating --> |
| 352 | + <licensesOutputDirectory>${project.basedir}/src/main/resources/licenses/THIRD_PARTY_LICENSES</licensesOutputDirectory> |
| 353 | + </configuration> |
| 354 | + </plugin> |
| 355 | + |
| 356 | + <!-- Override maven-resources-plugin to write to actual resource directory --> |
| 357 | + <plugin> |
| 358 | + <artifactId>maven-resources-plugin</artifactId> |
| 359 | + <executions> |
| 360 | + <execution> |
| 361 | + <id>copy-main-license</id> |
| 362 | + <configuration> |
| 363 | + <!-- Override to write directly to resources when updating --> |
| 364 | + <outputDirectory>${project.basedir}/src/main/resources/licenses</outputDirectory> |
| 365 | + </configuration> |
| 366 | + </execution> |
| 367 | + </executions> |
| 368 | + </plugin> |
| 369 | + </plugins> |
| 370 | + </build> |
| 371 | + </profile> |
| 372 | + </profiles> |
| 373 | + |
332 | 374 | </project> |
0 commit comments