|
50 | 50 |
|
51 | 51 | <jjwt.version>0.12.6</jjwt.version> |
52 | 52 | <jackson.version>2.17.1</jackson.version> |
| 53 | + |
| 54 | + <generatedDirRelative>src/generated/java</generatedDirRelative> |
| 55 | + |
| 56 | + <!-- Ignore generated code --> |
| 57 | + <sonar.exclusions> |
| 58 | + src/generated/** |
| 59 | + </sonar.exclusions> |
53 | 60 | </properties> |
54 | 61 |
|
55 | 62 | <repositories> |
|
112 | 119 | <artifactId>jackson-dataformat-xml</artifactId> |
113 | 120 | <version>${jackson.version}</version> |
114 | 121 | </dependency> |
| 122 | + <dependency> |
| 123 | + <groupId>com.fasterxml.jackson.datatype</groupId> |
| 124 | + <artifactId>jackson-datatype-jsr310</artifactId> |
| 125 | + <version>${jackson.version}</version> |
| 126 | + </dependency> |
| 127 | + <!-- HTTP client: apache client --> |
| 128 | + <dependency> |
| 129 | + <groupId>org.apache.httpcomponents.client5</groupId> |
| 130 | + <artifactId>httpclient5</artifactId> |
| 131 | + <version>5.3.1</version> |
| 132 | + </dependency> |
| 133 | + <dependency> |
| 134 | + <groupId>org.openapitools</groupId> |
| 135 | + <artifactId>jackson-databind-nullable</artifactId> |
| 136 | + <version>0.2.6</version> |
| 137 | + </dependency> |
115 | 138 | <dependency> |
116 | 139 | <groupId>org.slf4j</groupId> |
117 | 140 | <artifactId>slf4j-api</artifactId> |
|
254 | 277 | </execution> |
255 | 278 | </executions> |
256 | 279 | </plugin> |
| 280 | + <plugin> |
| 281 | + <groupId>org.codehaus.mojo</groupId> |
| 282 | + <artifactId>build-helper-maven-plugin</artifactId> |
| 283 | + <version>3.5.0</version> |
| 284 | + <executions> |
| 285 | + <execution> |
| 286 | + <phase>generate-sources</phase> |
| 287 | + <goals> |
| 288 | + <goal>add-source</goal> |
| 289 | + </goals> |
| 290 | + <configuration> |
| 291 | + <sources> |
| 292 | + <source>${generatedDirRelative}</source> |
| 293 | + </sources> |
| 294 | + </configuration> |
| 295 | + </execution> |
| 296 | + </executions> |
| 297 | + </plugin> |
257 | 298 | </plugins> |
258 | 299 | </build> |
259 | 300 | <profiles> |
|
349 | 390 | </build> |
350 | 391 | </profile> |
351 | 392 | <profile> |
352 | | - <id>pmd</id> |
| 393 | + <id>openapi-generator</id> |
| 394 | + <properties> |
| 395 | + <componentDir>bzst/dip/client/generated</componentDir> |
| 396 | + <componentPackage>bzst.dip.client.generated</componentPackage> |
| 397 | + |
| 398 | + <generatedDir>${project.basedir}/${generatedDirRelative}</generatedDir> |
| 399 | + <openApiRelativeGeneratorDir>src/gen</openApiRelativeGeneratorDir> |
| 400 | + <openApiGeneratorDir> |
| 401 | + ${project.basedir}/target/generated-sources/openapi/${openApiRelativeGeneratorDir} |
| 402 | + </openApiGeneratorDir> |
| 403 | + </properties> |
353 | 404 | <build> |
354 | 405 | <plugins> |
355 | 406 | <plugin> |
356 | 407 | <groupId>org.apache.maven.plugins</groupId> |
| 408 | + <artifactId>maven-clean-plugin</artifactId> |
| 409 | + <version>3.3.2</version> |
| 410 | + <executions> |
| 411 | + <execution> |
| 412 | + <id>pre-generation-clean</id> |
| 413 | + <phase>initialize</phase> |
| 414 | + <goals> |
| 415 | + <goal>clean</goal> |
| 416 | + </goals> |
| 417 | + <configuration> |
| 418 | + <excludeDefaultDirectories>true</excludeDefaultDirectories> |
| 419 | + <filesets> |
| 420 | + <fileset> |
| 421 | + <directory>${generatedDir}</directory> |
| 422 | + </fileset> |
| 423 | + </filesets> |
| 424 | + </configuration> |
| 425 | + </execution> |
| 426 | + <execution> |
| 427 | + <id>post-generation-clean</id> |
| 428 | + <phase>process-resources</phase> |
| 429 | + <goals> |
| 430 | + <goal>clean</goal> |
| 431 | + </goals> |
| 432 | + </execution> |
| 433 | + </executions> |
| 434 | + </plugin> |
| 435 | + <plugin> |
| 436 | + <groupId>org.openapitools</groupId> |
| 437 | + <artifactId>openapi-generator-maven-plugin</artifactId> |
| 438 | + <version>7.5.0</version> |
| 439 | + <executions> |
| 440 | + <execution> |
| 441 | + <goals> |
| 442 | + <goal>generate</goal> |
| 443 | + </goals> |
| 444 | + <configuration> |
| 445 | + <inputSpec>${project.basedir}/../openapi/openapi.yml</inputSpec> |
| 446 | + <generatorName>java</generatorName> |
| 447 | + <configOptions> |
| 448 | + <sourceFolder>${openApiRelativeGeneratorDir}</sourceFolder> |
| 449 | + <library>apache-httpclient</library> |
| 450 | + <apiPackage>software.xdev.${componentPackage}.api</apiPackage> |
| 451 | + <modelPackage>software.xdev.${componentPackage}.model</modelPackage> |
| 452 | + <invokerPackage>software.xdev.${componentPackage}.client</invokerPackage> |
| 453 | + <!-- Otherwise throw and catch everywhere --> |
| 454 | + <useRuntimeException>true</useRuntimeException> |
| 455 | + <!-- Some fields of API have been ignored because they are unused --> |
| 456 | + <disallowAdditionalPropertiesIfNotPresent>false |
| 457 | + </disallowAdditionalPropertiesIfNotPresent> |
| 458 | + <!-- Use newer Jakarta EE instead of Javax --> |
| 459 | + <useJakartaEe>true</useJakartaEe> |
| 460 | + <hideGenerationTimestamp>true</hideGenerationTimestamp> |
| 461 | + </configOptions> |
| 462 | + <!-- No tests and documentation because we don't use that --> |
| 463 | + <generateModelTests>false</generateModelTests> |
| 464 | + <generateApiTests>false</generateApiTests> |
| 465 | + <generateModelDocumentation>false</generateModelDocumentation> |
| 466 | + <generateApiDocumentation>false</generateApiDocumentation> |
| 467 | + </configuration> |
| 468 | + </execution> |
| 469 | + </executions> |
| 470 | + </plugin> |
| 471 | + <plugin> |
| 472 | + <groupId>org.apache.maven.plugins</groupId> |
| 473 | + <artifactId>maven-resources-plugin</artifactId> |
| 474 | + <version>3.3.1</version> |
| 475 | + <executions> |
| 476 | + <execution> |
| 477 | + <id>copy-generated-resources</id> |
| 478 | + <phase>process-sources</phase> |
| 479 | + <goals> |
| 480 | + <goal>copy-resources</goal> |
| 481 | + </goals> |
| 482 | + <configuration> |
| 483 | + <outputDirectory>${generatedDir}</outputDirectory> |
| 484 | + <resources> |
| 485 | + <resource> |
| 486 | + <directory>${openApiGeneratorDir}</directory> |
| 487 | + </resource> |
| 488 | + </resources> |
| 489 | + </configuration> |
| 490 | + </execution> |
| 491 | + </executions> |
| 492 | + </plugin> |
| 493 | + <plugin> |
| 494 | + <groupId>software.xdev</groupId> |
| 495 | + <artifactId>find-and-replace-maven-plugin</artifactId> |
| 496 | + <version>1.0.3</version> |
| 497 | + <executions> |
| 498 | + <execution> |
| 499 | + <!-- Remove so that we don't need additional dependency --> |
| 500 | + <id>remove-unused-import-com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider</id> |
| 501 | + <phase>process-sources</phase> |
| 502 | + <goals> |
| 503 | + <goal>file-contents</goal> |
| 504 | + </goals> |
| 505 | + <configuration> |
| 506 | + <baseDir>${generatedDirRelative}/software/xdev/${componentDir}/client/</baseDir> |
| 507 | + <fileMask>ApiClient.java</fileMask> |
| 508 | + <!-- @formatter:off DO NOT INTRODUCE LINE BREAK --> |
| 509 | + <findRegex>^import com\.fasterxml\.jackson\.jaxrs\.json\.JacksonJsonProvider;(\r?\n)</findRegex> |
| 510 | + <!-- @formatter:on --> |
| 511 | + <replaceLineBased>false</replaceLineBased> |
| 512 | + </configuration> |
| 513 | + </execution> |
| 514 | + <execution> |
| 515 | + <!-- Changes with each generator version --> |
| 516 | + <id>remove-generated-annotation</id> |
| 517 | + <phase>process-sources</phase> |
| 518 | + <goals> |
| 519 | + <goal>file-contents</goal> |
| 520 | + </goals> |
| 521 | + <configuration> |
| 522 | + <baseDir>${generatedDirRelative}/software/xdev/${componentDir}/</baseDir> |
| 523 | + <recursive>true</recursive> |
| 524 | + <fileMask>.java</fileMask> |
| 525 | + <findRegex>^@jakarta\.annotation\.Generated.*(\r?\n)</findRegex> |
| 526 | + <replaceAll>false</replaceAll> |
| 527 | + <replaceLineBased>false</replaceLineBased> |
| 528 | + </configuration> |
| 529 | + </execution> |
| 530 | + <execution> |
| 531 | + <!-- Requiring Java serialization indicates a serious misuse of the API --> |
| 532 | + <id>remove-serialVersionUID</id> |
| 533 | + <phase>process-sources</phase> |
| 534 | + <goals> |
| 535 | + <goal>file-contents</goal> |
| 536 | + </goals> |
| 537 | + <configuration> |
| 538 | + <baseDir>${generatedDirRelative}/software/xdev/${componentDir}/</baseDir> |
| 539 | + <recursive>true</recursive> |
| 540 | + <fileMask>.java</fileMask> |
| 541 | + <findRegex>^.*serialVersionUID.*(\r?\n)(\s*\r?\n)?</findRegex> |
| 542 | + <replaceAll>false</replaceAll> |
| 543 | + <replaceLineBased>false</replaceLineBased> |
| 544 | + </configuration> |
| 545 | + </execution> |
| 546 | + </executions> |
| 547 | + </plugin> |
| 548 | + </plugins> |
| 549 | + </build> |
| 550 | + </profile> |
| 551 | + <profile> |
| 552 | + <id>pmd</id> |
| 553 | + <build> |
| 554 | + <plugins> |
| 555 | + <plugin> |
357 | 556 | <artifactId>maven-pmd-plugin</artifactId> |
358 | 557 | <version>3.26.0</version> |
359 | 558 | <configuration> |
|
362 | 561 | <rulesets> |
363 | 562 | <ruleset>../.config/pmd/ruleset.xml</ruleset> |
364 | 563 | </rulesets> |
| 564 | + <excludes> |
| 565 | + <exclude>**/generated/**/*.java</exclude> |
| 566 | + </excludes> |
365 | 567 | </configuration> |
366 | 568 | <dependencies> |
367 | 569 | <dependency> |
|
0 commit comments