|
50 | 50 |
|
51 | 51 | <jjwt.version>0.12.5</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> |
|
243 | 266 | </execution> |
244 | 267 | </executions> |
245 | 268 | </plugin> |
| 269 | + <plugin> |
| 270 | + <groupId>org.codehaus.mojo</groupId> |
| 271 | + <artifactId>build-helper-maven-plugin</artifactId> |
| 272 | + <version>3.5.0</version> |
| 273 | + <executions> |
| 274 | + <execution> |
| 275 | + <phase>generate-sources</phase> |
| 276 | + <goals> |
| 277 | + <goal>add-source</goal> |
| 278 | + </goals> |
| 279 | + <configuration> |
| 280 | + <sources> |
| 281 | + <source>${generatedDirRelative}</source> |
| 282 | + </sources> |
| 283 | + </configuration> |
| 284 | + </execution> |
| 285 | + </executions> |
| 286 | + </plugin> |
246 | 287 | </plugins> |
247 | 288 | </build> |
248 | 289 | <profiles> |
|
320 | 361 | </plugins> |
321 | 362 | </build> |
322 | 363 | </profile> |
| 364 | + <profile> |
| 365 | + <id>openapi-generator</id> |
| 366 | + <properties> |
| 367 | + <componentDir>bzst/dip/client/generated</componentDir> |
| 368 | + <componentPackage>bzst.dip.client.generated</componentPackage> |
| 369 | + |
| 370 | + <generatedDir>${project.basedir}/${generatedDirRelative}</generatedDir> |
| 371 | + <openApiRelativeGeneratorDir>src/gen</openApiRelativeGeneratorDir> |
| 372 | + <openApiGeneratorDir> |
| 373 | + ${project.basedir}/target/generated-sources/openapi/${openApiRelativeGeneratorDir} |
| 374 | + </openApiGeneratorDir> |
| 375 | + </properties> |
| 376 | + <build> |
| 377 | + <plugins> |
| 378 | + <plugin> |
| 379 | + <groupId>org.apache.maven.plugins</groupId> |
| 380 | + <artifactId>maven-clean-plugin</artifactId> |
| 381 | + <version>3.3.2</version> |
| 382 | + <executions> |
| 383 | + <execution> |
| 384 | + <id>pre-generation-clean</id> |
| 385 | + <phase>initialize</phase> |
| 386 | + <goals> |
| 387 | + <goal>clean</goal> |
| 388 | + </goals> |
| 389 | + <configuration> |
| 390 | + <excludeDefaultDirectories>true</excludeDefaultDirectories> |
| 391 | + <filesets> |
| 392 | + <fileset> |
| 393 | + <directory>${generatedDir}</directory> |
| 394 | + </fileset> |
| 395 | + </filesets> |
| 396 | + </configuration> |
| 397 | + </execution> |
| 398 | + <execution> |
| 399 | + <id>post-generation-clean</id> |
| 400 | + <phase>process-resources</phase> |
| 401 | + <goals> |
| 402 | + <goal>clean</goal> |
| 403 | + </goals> |
| 404 | + </execution> |
| 405 | + </executions> |
| 406 | + </plugin> |
| 407 | + <plugin> |
| 408 | + <groupId>org.openapitools</groupId> |
| 409 | + <artifactId>openapi-generator-maven-plugin</artifactId> |
| 410 | + <version>7.5.0</version> |
| 411 | + <executions> |
| 412 | + <execution> |
| 413 | + <goals> |
| 414 | + <goal>generate</goal> |
| 415 | + </goals> |
| 416 | + <configuration> |
| 417 | + <inputSpec>${project.basedir}/../openapi/openapi.yml</inputSpec> |
| 418 | + <generatorName>java</generatorName> |
| 419 | + <configOptions> |
| 420 | + <sourceFolder>${openApiRelativeGeneratorDir}</sourceFolder> |
| 421 | + <library>apache-httpclient</library> |
| 422 | + <apiPackage>software.xdev.${componentPackage}.api</apiPackage> |
| 423 | + <modelPackage>software.xdev.${componentPackage}.model</modelPackage> |
| 424 | + <invokerPackage>software.xdev.${componentPackage}.client</invokerPackage> |
| 425 | + <!-- Otherwise throw and catch everywhere --> |
| 426 | + <useRuntimeException>true</useRuntimeException> |
| 427 | + <!-- Some fields of API have been ignored because they are unused --> |
| 428 | + <disallowAdditionalPropertiesIfNotPresent>false |
| 429 | + </disallowAdditionalPropertiesIfNotPresent> |
| 430 | + <!-- Use newer Jakarta EE instead of Javax --> |
| 431 | + <useJakartaEe>true</useJakartaEe> |
| 432 | + <hideGenerationTimestamp>true</hideGenerationTimestamp> |
| 433 | + </configOptions> |
| 434 | + <!-- No tests and documentation because we don't use that --> |
| 435 | + <generateModelTests>false</generateModelTests> |
| 436 | + <generateApiTests>false</generateApiTests> |
| 437 | + <generateModelDocumentation>false</generateModelDocumentation> |
| 438 | + <generateApiDocumentation>false</generateApiDocumentation> |
| 439 | + </configuration> |
| 440 | + </execution> |
| 441 | + </executions> |
| 442 | + </plugin> |
| 443 | + <plugin> |
| 444 | + <groupId>org.apache.maven.plugins</groupId> |
| 445 | + <artifactId>maven-resources-plugin</artifactId> |
| 446 | + <version>3.3.1</version> |
| 447 | + <executions> |
| 448 | + <execution> |
| 449 | + <id>copy-generated-resources</id> |
| 450 | + <phase>process-sources</phase> |
| 451 | + <goals> |
| 452 | + <goal>copy-resources</goal> |
| 453 | + </goals> |
| 454 | + <configuration> |
| 455 | + <outputDirectory>${generatedDir}</outputDirectory> |
| 456 | + <resources> |
| 457 | + <resource> |
| 458 | + <directory>${openApiGeneratorDir}</directory> |
| 459 | + </resource> |
| 460 | + </resources> |
| 461 | + </configuration> |
| 462 | + </execution> |
| 463 | + </executions> |
| 464 | + </plugin> |
| 465 | + <plugin> |
| 466 | + <groupId>software.xdev</groupId> |
| 467 | + <artifactId>find-and-replace-maven-plugin</artifactId> |
| 468 | + <version>1.0.0</version> |
| 469 | + <executions> |
| 470 | + <execution> |
| 471 | + <!-- Remove so that we don't need additional dependency --> |
| 472 | + <id>remove-unused-import-com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider</id> |
| 473 | + <phase>process-sources</phase> |
| 474 | + <goals> |
| 475 | + <goal>file-contents</goal> |
| 476 | + </goals> |
| 477 | + <configuration> |
| 478 | + <baseDir>${generatedDirRelative}/software/xdev/${componentDir}/client/</baseDir> |
| 479 | + <fileMask>ApiClient.java</fileMask> |
| 480 | + <!-- @formatter:off DO NOT INTRODUCE LINE BREAK --> |
| 481 | + <findRegex>^import com\.fasterxml\.jackson\.jaxrs\.json\.JacksonJsonProvider;(\r?\n)</findRegex> |
| 482 | + <!-- @formatter:on --> |
| 483 | + <replaceLineBased>false</replaceLineBased> |
| 484 | + </configuration> |
| 485 | + </execution> |
| 486 | + <execution> |
| 487 | + <!-- Changes with each generator version --> |
| 488 | + <id>remove-generated-annotation</id> |
| 489 | + <phase>process-sources</phase> |
| 490 | + <goals> |
| 491 | + <goal>file-contents</goal> |
| 492 | + </goals> |
| 493 | + <configuration> |
| 494 | + <baseDir>${generatedDirRelative}/software/xdev/${componentDir}/</baseDir> |
| 495 | + <recursive>true</recursive> |
| 496 | + <fileMask>.java</fileMask> |
| 497 | + <findRegex>^@jakarta\.annotation\.Generated.*(\r?\n)</findRegex> |
| 498 | + <replaceAll>false</replaceAll> |
| 499 | + <replaceLineBased>false</replaceLineBased> |
| 500 | + </configuration> |
| 501 | + </execution> |
| 502 | + <execution> |
| 503 | + <!-- Requiring Java serialization indicates a serious misuse of the API --> |
| 504 | + <id>remove-serialVersionUID</id> |
| 505 | + <phase>process-sources</phase> |
| 506 | + <goals> |
| 507 | + <goal>file-contents</goal> |
| 508 | + </goals> |
| 509 | + <configuration> |
| 510 | + <baseDir>${generatedDirRelative}/software/xdev/${componentDir}/</baseDir> |
| 511 | + <recursive>true</recursive> |
| 512 | + <fileMask>.java</fileMask> |
| 513 | + <findRegex>^.*serialVersionUID.*(\r?\n)(\s*\r?\n)?</findRegex> |
| 514 | + <replaceAll>false</replaceAll> |
| 515 | + <replaceLineBased>false</replaceLineBased> |
| 516 | + </configuration> |
| 517 | + </execution> |
| 518 | + </executions> |
| 519 | + </plugin> |
| 520 | + </plugins> |
| 521 | + </build> |
| 522 | + </profile> |
323 | 523 | </profiles> |
324 | 524 | </project> |
0 commit comments