|
47 | 47 |
|
48 | 48 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
49 | 49 | <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> |
| 50 | + |
| 51 | + <generatedDirRelative>src/generated/java</generatedDirRelative> |
50 | 52 | </properties> |
51 | 53 |
|
| 54 | + <dependencies> |
| 55 | + <!-- HTTP client: apache client --> |
| 56 | + <dependency> |
| 57 | + <groupId>org.apache.httpcomponents.client5</groupId> |
| 58 | + <artifactId>httpclient5</artifactId> |
| 59 | + <version>5.6.3</version> |
| 60 | + </dependency> |
| 61 | + |
| 62 | + <!-- JSON processing: jackson --> |
| 63 | + <dependency> |
| 64 | + <groupId>tools.jackson.core</groupId> |
| 65 | + <artifactId>jackson-databind</artifactId> |
| 66 | + <version>3.2.1</version> |
| 67 | + </dependency> |
| 68 | + <dependency> |
| 69 | + <groupId>org.openapitools</groupId> |
| 70 | + <artifactId>jackson-databind-nullable</artifactId> |
| 71 | + <version>0.2.11</version> |
| 72 | + </dependency> |
| 73 | + |
| 74 | + <dependency> |
| 75 | + <groupId>jakarta.annotation</groupId> |
| 76 | + <artifactId>jakarta.annotation-api</artifactId> |
| 77 | + <version>3.0.0</version> |
| 78 | + </dependency> |
| 79 | + </dependencies> |
| 80 | + |
52 | 81 | <build> |
53 | 82 | <pluginManagement> |
54 | 83 | <plugins> |
|
137 | 166 | </execution> |
138 | 167 | </executions> |
139 | 168 | </plugin> |
| 169 | + |
| 170 | + <plugin> |
| 171 | + <groupId>org.codehaus.mojo</groupId> |
| 172 | + <artifactId>build-helper-maven-plugin</artifactId> |
| 173 | + <version>3.6.1</version> |
| 174 | + <executions> |
| 175 | + <execution> |
| 176 | + <phase>generate-sources</phase> |
| 177 | + <goals> |
| 178 | + <goal>add-source</goal> |
| 179 | + </goals> |
| 180 | + <configuration> |
| 181 | + <sources> |
| 182 | + <source>${generatedDirRelative}</source> |
| 183 | + </sources> |
| 184 | + </configuration> |
| 185 | + </execution> |
| 186 | + </executions> |
| 187 | + </plugin> |
140 | 188 | </plugins> |
141 | 189 | </build> |
142 | 190 | <profiles> |
|
203 | 251 | </plugins> |
204 | 252 | </build> |
205 | 253 | </profile> |
| 254 | + <profile> |
| 255 | + <id>openapi-generator</id> |
| 256 | + <properties> |
| 257 | + <componentName>INSERT_NAME_HERE</componentName> |
| 258 | + |
| 259 | + <generatedDir>${project.basedir}/${generatedDirRelative}</generatedDir> |
| 260 | + <openApiRelativeGeneratorDir>src/gen</openApiRelativeGeneratorDir> |
| 261 | + <openApiGeneratorDir> |
| 262 | + ${project.basedir}/target/generated-sources/openapi/${openApiRelativeGeneratorDir} |
| 263 | + </openApiGeneratorDir> |
| 264 | + </properties> |
| 265 | + <build> |
| 266 | + <plugins> |
| 267 | + <plugin> |
| 268 | + <groupId>org.apache.maven.plugins</groupId> |
| 269 | + <artifactId>maven-clean-plugin</artifactId> |
| 270 | + <version>3.5.0</version> |
| 271 | + <executions> |
| 272 | + <execution> |
| 273 | + <id>pre-generation-clean</id> |
| 274 | + <phase>initialize</phase> |
| 275 | + <goals> |
| 276 | + <goal>clean</goal> |
| 277 | + </goals> |
| 278 | + <configuration> |
| 279 | + <excludeDefaultDirectories>true</excludeDefaultDirectories> |
| 280 | + <filesets> |
| 281 | + <fileset> |
| 282 | + <directory>${generatedDir}</directory> |
| 283 | + </fileset> |
| 284 | + </filesets> |
| 285 | + </configuration> |
| 286 | + </execution> |
| 287 | + <execution> |
| 288 | + <id>post-generation-clean</id> |
| 289 | + <phase>process-resources</phase> |
| 290 | + <goals> |
| 291 | + <goal>clean</goal> |
| 292 | + </goals> |
| 293 | + </execution> |
| 294 | + </executions> |
| 295 | + </plugin> |
| 296 | + <plugin> |
| 297 | + <groupId>org.openapitools</groupId> |
| 298 | + <artifactId>openapi-generator-maven-plugin</artifactId> |
| 299 | + <version>7.24.0</version> |
| 300 | + <executions> |
| 301 | + <execution> |
| 302 | + <goals> |
| 303 | + <goal>generate</goal> |
| 304 | + </goals> |
| 305 | + <configuration> |
| 306 | + <inputSpec>${project.basedir}/../openapi/openapi.yml</inputSpec> |
| 307 | + <generatorName>java</generatorName> |
| 308 | + <configOptions> |
| 309 | + <sourceFolder>${openApiRelativeGeneratorDir}</sourceFolder> |
| 310 | + <library>apache-httpclient</library> |
| 311 | + <apiPackage>software.xdev.${componentName}.api</apiPackage> |
| 312 | + <modelPackage>software.xdev.${componentName}.model</modelPackage> |
| 313 | + <invokerPackage>software.xdev.${componentName}.client</invokerPackage> |
| 314 | + <!-- Otherwise throw and catch everywhere --> |
| 315 | + <useRuntimeException>true</useRuntimeException> |
| 316 | + <!-- Some fields of API have been ignored because they are unused --> |
| 317 | + <disallowAdditionalPropertiesIfNotPresent>false |
| 318 | + </disallowAdditionalPropertiesIfNotPresent> |
| 319 | + <!-- Use newer Jakarta EE instead of Javax --> |
| 320 | + <useJakartaEe>true</useJakartaEe> |
| 321 | + <hideGenerationTimestamp>true</hideGenerationTimestamp> |
| 322 | + <useJackson3>true</useJackson3> |
| 323 | + </configOptions> |
| 324 | + <!-- No tests and documentation because we don't use that --> |
| 325 | + <generateModelTests>false</generateModelTests> |
| 326 | + <generateApiTests>false</generateApiTests> |
| 327 | + <generateModelDocumentation>false</generateModelDocumentation> |
| 328 | + <generateApiDocumentation>false</generateApiDocumentation> |
| 329 | + </configuration> |
| 330 | + </execution> |
| 331 | + </executions> |
| 332 | + </plugin> |
| 333 | + <plugin> |
| 334 | + <groupId>org.apache.maven.plugins</groupId> |
| 335 | + <artifactId>maven-resources-plugin</artifactId> |
| 336 | + <version>3.5.0</version> |
| 337 | + <executions> |
| 338 | + <execution> |
| 339 | + <id>copy-generated-resources</id> |
| 340 | + <phase>process-sources</phase> |
| 341 | + <goals> |
| 342 | + <goal>copy-resources</goal> |
| 343 | + </goals> |
| 344 | + <configuration> |
| 345 | + <outputDirectory>${generatedDir}</outputDirectory> |
| 346 | + <resources> |
| 347 | + <resource> |
| 348 | + <directory>${openApiGeneratorDir}</directory> |
| 349 | + </resource> |
| 350 | + </resources> |
| 351 | + </configuration> |
| 352 | + </execution> |
| 353 | + </executions> |
| 354 | + </plugin> |
| 355 | + <plugin> |
| 356 | + <groupId>software.xdev</groupId> |
| 357 | + <artifactId>find-and-replace-maven-plugin</artifactId> |
| 358 | + <version>1.0.5</version> |
| 359 | + <executions> |
| 360 | + <execution> |
| 361 | + <!-- Remove so that we don't need additional dependency --> |
| 362 | + <id>remove-unused-import-com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider</id> |
| 363 | + <phase>process-sources</phase> |
| 364 | + <goals> |
| 365 | + <goal>file-contents</goal> |
| 366 | + </goals> |
| 367 | + <configuration> |
| 368 | + <baseDir>${generatedDirRelative}/software/xdev/${componentName}/client/</baseDir> |
| 369 | + <fileMask>ApiClient.java</fileMask> |
| 370 | + <!-- @formatter:off DO NOT INTRODUCE LINE BREAK --> |
| 371 | + <findRegex>^import com\.fasterxml\.jackson\.jaxrs\.json\.JacksonJsonProvider;(\r?\n)</findRegex> |
| 372 | + <!-- @formatter:on --> |
| 373 | + <replaceLineBased>false</replaceLineBased> |
| 374 | + </configuration> |
| 375 | + </execution> |
| 376 | + <execution> |
| 377 | + <!-- Changes with each generator version --> |
| 378 | + <id>remove-generated-annotation</id> |
| 379 | + <phase>process-sources</phase> |
| 380 | + <goals> |
| 381 | + <goal>file-contents</goal> |
| 382 | + </goals> |
| 383 | + <configuration> |
| 384 | + <baseDir>${generatedDirRelative}/software/xdev/${componentName}/</baseDir> |
| 385 | + <recursive>true</recursive> |
| 386 | + <fileMask>.java</fileMask> |
| 387 | + <findRegex>^@jakarta\.annotation\.Generated.*(\r?\n)</findRegex> |
| 388 | + <replaceAll>false</replaceAll> |
| 389 | + <replaceLineBased>false</replaceLineBased> |
| 390 | + </configuration> |
| 391 | + </execution> |
| 392 | + <execution> |
| 393 | + <!-- Requiring Java serialization indicates a serious misuse of the API --> |
| 394 | + <id>remove-serialVersionUID</id> |
| 395 | + <phase>process-sources</phase> |
| 396 | + <goals> |
| 397 | + <goal>file-contents</goal> |
| 398 | + </goals> |
| 399 | + <configuration> |
| 400 | + <baseDir>${generatedDirRelative}/software/xdev/${componentName}/</baseDir> |
| 401 | + <recursive>true</recursive> |
| 402 | + <fileMask>.java</fileMask> |
| 403 | + <findRegex>^.*serialVersionUID.*(\r?\n)(\s*\r?\n)?</findRegex> |
| 404 | + <replaceAll>false</replaceAll> |
| 405 | + <replaceLineBased>false</replaceLineBased> |
| 406 | + </configuration> |
| 407 | + </execution> |
| 408 | + </executions> |
| 409 | + </plugin> |
| 410 | + </plugins> |
| 411 | + </build> |
| 412 | + </profile> |
206 | 413 | <profile> |
207 | 414 | <id>checkstyle</id> |
208 | 415 | <build> |
|
248 | 455 | <rulesets> |
249 | 456 | <ruleset>../.config/pmd/java/ruleset.xml</ruleset> |
250 | 457 | </rulesets> |
| 458 | + <!-- All code is auto-generated --> |
| 459 | + <excludes> |
| 460 | + <exclude>**/**</exclude> |
| 461 | + </excludes> |
251 | 462 | </configuration> |
252 | 463 | <dependencies> |
253 | 464 | <dependency> |
|
0 commit comments