-
Notifications
You must be signed in to change notification settings - Fork 1
/
pom.xml
586 lines (541 loc) · 26.3 KB
/
pom.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>dk.statsbiblioteket.sbprojects</groupId>
<artifactId>sbprojects-parent</artifactId>
<version>80</version>
</parent>
<name>ds-image</name> <!-- Human readable name, uppercase and spaces welcome -->
<groupId>dk.kb.image</groupId>
<artifactId>ds-image</artifactId>
<version>1.7.1-SNAPSHOT</version>
<packaging>war</packaging>
<description>ds-image by the Royal Danish Library</description>
<repositories>
<repository>
<id>sbforge-nexus</id>
<url>https://sbforge.org/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<scm>
<url>https://github.com/kb-dk/ds-image</url>
<connection>scm:git:[email protected]:kb-dk/ds-image.git</connection>
<developerConnection>scm:git:[email protected]:kb-dk/ds-image.git</developerConnection>
<tag>HEAD</tag>
</scm>
<licenses>
<!--SBForge stuff should have a license-->
<license>
<name>${license.name}</name>
<url>${license.url}</url>
</license>
</licenses>
<properties>
<!-- Specify java version here, to support forbiddenapis plugin -->
<!-- If the version is changed from 17 to something else, Jenkinsfile must also be updated -->
<!-- ds-image: We use Java 11 for now, as our devel server is still at that level -->
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<!-- Enable forbiddenapis plugin, do disable set to none -->
<api.check.phase>process-test-classes</api.check.phase>
<!--Specify the licenses here, so they can be picked up by openAPI-->
<license.name>Apache License, Version 2.0</license.name>
<license.url>https://www.apache.org/licenses/LICENSE-2.0.txt</license.url>
<timestamp>${maven.build.timestamp}</timestamp>
<project.package>dk.kb.image</project.package>
</properties>
<dependencies>
<dependency>
<groupId>dk.kb.util</groupId>
<artifactId>kb-util</artifactId>
<version>1.5.11</version>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>4.0.2</version>
<scope>provided</scope>
</dependency>
<!-- Client for ds-license. This will also require the org.openapitools dependency-->
<dependency>
<groupId>dk.kb.license</groupId>
<artifactId>ds-license</artifactId>
<version>1.5.0</version>
<type>jar</type>
<classifier>classes</classifier>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Apache CXF and servlet stuff -->
<dependency>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
<version>2.1.6</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<!-- Latest version is 4.0.3. Not tested -->
<version>3.6.4</version>
<scope>runtime</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.xml.ws/jaxws-api -->
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>1.8</version>
</dependency>
<!--For getting thumbnails from Kaltura -->
<dependency>
<groupId>dk.kb.kaltura</groupId>
<artifactId>ds-kaltura</artifactId>
<version>1.2.5</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-xml-provider</artifactId>
<version>2.10.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.openapitools/jackson-databind-nullable
Used for OpenAPI client generation -->
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>0.2.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>2.16.0</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-client</artifactId>
<version>3.6.2</version>
<!-- Latest version is 4.0.3. Not tested -->
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-service-description</artifactId>
<!-- Latest version is 4.0.3. Not tested -->
<version>3.6.2</version>
</dependency>
<dependency>
<!--For the openapi endpoint /openapi.json-->
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-service-description-openapi-v3</artifactId>
<!-- Latest version is 4.0.3. Not tested -->
<version>3.6.2</version>
</dependency>
<dependency>
<!--For the swagger UI endpoint /api-docs?url=openapi.json-->
<groupId>org.webjars</groupId>
<artifactId>swagger-ui</artifactId>
<version>5.9.0</version>
</dependency>
<!-- openapitools dependency -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jaxrs</artifactId>
<exclusions>
<exclusion>
<artifactId>jsr311-api</artifactId>
<groupId>javax.ws.rs</groupId>
</exclusion>
<exclusion>
<!-- swagger-jaxrs has 1.1.0.Final, but transitive resolving has 2.0.2 somewhere-->
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</exclusion>
</exclusions>
<version>1.5.23</version>
</dependency>
<!-- To get date parsing to work? -->
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.module/jackson-modules-java8 -->
<!-- <dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-modules-java8</artifactId>
<version>2.13.1</version>
<type>pom</type>
<scope>runtime</scope>
</dependency>-->
<!-- To get client generation to work -->
<!-- https://mvnrepository.com/artifact/org.openapitools/openapi-generator -->
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator</artifactId>
<version>7.1.0</version>
<exclusions>
<exclusion>
<!-- The slf4j-simple logs to stderr and stdout, ignoring logback.xml -->
<artifactId>org.slf4j</artifactId>
<groupId>slf4j-simple</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- URI templating by RFC6570 -->
<dependency>
<groupId>com.damnhandy</groupId>
<artifactId>handy-uri-templates</artifactId>
<version>2.1.7</version>
</dependency>
<!-- OAuth support -->
<!-- https://mvnrepository.com/artifact/org.keycloak/keycloak-core -->
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-core</artifactId>
<version>24.0.1</version>
<exclusions>
<exclusion>
<!-- mockserver-junit-jupiter has 1.1, but transitive resolving has 1.2.2 somewhere-->
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Logging dependencies -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.11</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<version>2.0.9</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>2.0.9</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>2.0.9</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.4.14</version>
</dependency>
<!-- Unit test -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.10.1</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mockito/mockito-junit-jupiter -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>5.7.0</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mock-server/mockserver-junit-jupiter -->
<dependency>
<groupId>org.mock-server</groupId>
<artifactId>mockserver-junit-jupiter</artifactId>
<version>5.15.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.9</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/openapi</directory>
<filtering>true</filtering>
</resource>
<!-- Needed as specifying <resources> overrides all previous definitions -->
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<!--This ensures that the ds-image-openapi_*.yaml have been filtered and copied to target/classes
BEFORE being used by the openapi generator above-->
<phase>generate-sources</phase>
<!--as both the openapi codegen and this execution happens at phase generate-sources, ensure
this happens first by having this placed above codegen in the pom-->
<goals>
<goal>resources</goal>
</goals>
</execution>
<execution>
<id>copy-resources</id>
<phase>compile</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/jetty-res</outputDirectory>
<resources>
<resource>
<directory>src/test/jetty</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>4.2.2</version>
<!-- Running this gives
[WARNING] The value (generator's option) must be either boolean or string. Default to `false`.
which seems to be an unresolved issue: https://github.com/OpenAPITools/openapi-generator/issues/9008 -->
<configuration>
<!-- https://openapi-generator.tech/docs/generators/java/ -->
<generatorName>jaxrs-cxf-extended</generatorName>
<inputSpec>${project.build.outputDirectory}/openapi.yaml</inputSpec><!-- Will always be overridden -->
<modelNameSuffix>Dto</modelNameSuffix>
<generateSupportingFiles>false</generateSupportingFiles>
<generateApiTests>false</generateApiTests>
<generateModelDocumentation>true</generateModelDocumentation>
<generateApis>true</generateApis>
<output>${project.basedir}</output>
<templateDirectory>src/main/templates/</templateDirectory>
<configOptions>
<withXml>true</withXml> <!-- Needed for XML serialization support in the Model -->
<!--https://openapi-generator.tech/docs/generators/jaxrs-cxf-extended/-->
<sourceFolder>target/generated-sources</sourceFolder>
<useSwaggerFeature>true</useSwaggerFeature>
<useSwaggerUI>true</useSwaggerUI>
<apiPackage>${project.package}.api</apiPackage>
<modelPackage>${project.package}.model</modelPackage>
<!--<dateLibrary>threetenbp</dateLibrary>-->
<!--<dateLibrary>Java11</dateLibrary>-->
<implFolder>src/main/java</implFolder>
<invokerPackage>${project.package}</invokerPackage>
</configOptions>
<packageName>${project.package}</packageName>
</configuration>
<executions>
<!-- Version 1 -->
<!-- When a new version is needed, make a copy of three v1-related executions below, then change
v1 to v2 in the copy.
Go to plugin.configuration.webResources.resource.includes in this pom.xml and extend the list
with v2 versions of the JSON & YAML files.
Also remember to:
* Create dk.kb.image.webservice.Application_v2
* Create src/main/openapi/ds-image-openapi_v2.yaml
* Update src/main/webapp/WEB-INF/web.xml
* Update src/main/webapp/api/index.html
-->
<execution>
<!-- Generate API file from the OpenAPI specification (positioned under the target/generated-sources/ folder).
These files are overwritten on all builds, so they should never be edited manually. -->
<id>v1: Generate model and api classes</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.build.outputDirectory}/ds-image-openapi_v1.yaml</inputSpec>
<ignoreFileOverride>
${project.basedir}/.openapi-codegen-ignore-api
</ignoreFileOverride>
<configOptions>
<apiPackage>${project.package}.api.v1</apiPackage>
<modelPackage>${project.package}.model.v1</modelPackage>
<!-- Setting this to true overwrites existing implementations.
Only set it temporarily when creating a new project -->
<generateOperationBody>false</generateOperationBody>
<sourceFolder>target/generated-sources</sourceFolder>
</configOptions>
</configuration>
</execution>
<execution>
<!-- The purpose is to generate skeleton implementation classes, if such classes are not already existing.
Since we always want to overwrite existing api & model-files when the OpenAPI specification is changed,
but never want to overwrite existing implementation-files, we need to do the generation in 2 steps. -->
<id>v1: Generate skeleton impl</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.build.outputDirectory}/ds-image-openapi_v1.yaml</inputSpec>
<ignoreFileOverride>${project.basedir}/.openapi-codegen-ignore-impl</ignoreFileOverride>
<configOptions>
<apiPackage>${project.package}.api.v1</apiPackage>
<modelPackage>${project.package}.model.v1</modelPackage>
<generateOperationBody>true</generateOperationBody>
</configOptions>
<skipOverwrite>true</skipOverwrite>
</configuration>
</execution>
<!-- Client for ds-image -->
<execution>
<id>Generate client for JAR package and use by other services</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.build.outputDirectory}/ds-image-openapi_v1.yaml</inputSpec>
<ignoreFileOverride>${project.basedir}/.openapi-codegen-ignore-api</ignoreFileOverride>
<generatorName>java</generatorName>
<library>native</library>
<!-- Do not generate doc or tests for this client, we will handle this ourselves-->
<generateApis>true</generateApis>
<generateApiTests>false</generateApiTests>
<generateApiDocumentation>false</generateApiDocumentation>
<generateModels>false</generateModels>
<generateModelTests>false</generateModelTests>
<generateModelDocumentation>false</generateModelDocumentation>
<!-- Ensure ONLY the ApiClient and supporting classes are created, not the gradle mess-->
<generateSupportingFiles>true</generateSupportingFiles>
<supportingFilesToGenerate>ApiClient.java,ApiException.java,Configuration.java,Pair.java</supportingFilesToGenerate>
<!-- Do NOT use the customised templates as they are only for the webservice part, not the client-->
<!-- Hacked by Asger by setting to an existing folder without templates -->
<templateDirectory>src/main/</templateDirectory>
<configOptions>
<apiPackage>${project.package}.client.v1</apiPackage>
<modelPackage>${project.package}.model.v1</modelPackage>
<invokerPackage>${project.package}.invoker.v1</invokerPackage>
<sourceFolder>target/generated-sources</sourceFolder>
<implFolder>target/generated-sources</implFolder>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
<!-- The generated classes for the OpenAPI client are problematic. Disable checking of those for now -->
<plugin>
<groupId>de.thetaphi</groupId>
<artifactId>forbiddenapis</artifactId>
<!-- No version or configuration here as it inherits from parent pom -->
<configuration>
<excludes>
<exclude>**/AccessApi.class</exclude>
<exclude>**/ServiceApi.class</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webXml>src/main/webapp/WEB-INF/web.xml</webXml>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
</archive>
<!-- Generate a JAR with client classes and openapi-YAML for easy use by other services -->
<attachClasses>true</attachClasses>
<!--Enable maven filtering for the web.xml-->
<filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
<webResources>
<webResource> <!-- Store application name, version and build time -->
<directory>${basedir}/src/main/resources/</directory>
<includes>
<include>ds-image.build.properties</include>
</includes>
<filtering>true</filtering>
</webResource>
<resource>
<!--Include the openapi spec files so we can serve them-->
<directory>${project.build.outputDirectory}</directory>
<targetPath>.</targetPath>
<includes>
<include>ds-image-openapi_v1.json</include>
<include>ds-image-openapi_v1.yaml</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
<!-- Used only for mvn jetty:run jetty:run-war -->
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>10.0.12</version>
<configuration>
<deployMode>FORK</deployMode>
<jvmArgs>-Xmx256m -Djetty.port=9077</jvmArgs>
<jettyXmls>${project.basedir}/target/jetty-res/jetty-env.xml</jettyXmls>
<useTestScope>true</useTestScope>
<!-- https://www.eclipse.org/jetty/documentation/jetty-10/programming-guide/index.html#jetty-run-goal -->
<!-- https://stackoverflow.com/questions/12493798/jetty-maven-plugin-using-scan -->
<scan>2</scan>
<webApp>
<contextPath>/${project.artifactId}/</contextPath>
<descriptor>${project.basedir}/target/${project.build.finalName}/WEB-INF/web.xml</descriptor>
<jettyEnvXml>${project.basedir}/target/jetty-res/jetty-env.xml</jettyEnvXml>
</webApp>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<tarLongFileMode>posix</tarLongFileMode>
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<goals>
<goal>single</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
<!-- Plugin used to extract information on the current git setup.
See: https://github.com/git-commit-id/git-commit-id-maven-plugin -->
<plugin>
<groupId>io.github.git-commit-id</groupId>
<artifactId>git-commit-id-maven-plugin</artifactId>
<version>7.0.0</version>
<executions>
<execution>
<id>get-the-git-infos</id>
<goals>
<goal>revision</goal>
</goals>
<phase>initialize</phase>
</execution>
</executions>
<configuration>
<includeOnlyProperties>
<includeOnlyProperty>git.commit.id</includeOnlyProperty>
<includeOnlyProperty>git.branch</includeOnlyProperty>
<includeOnlyProperty>git.closest.tag.name</includeOnlyProperty>
<includeOnlyProperty>git.commit.author.time</includeOnlyProperty>
</includeOnlyProperties>
</configuration>
</plugin>
</plugins>
</build>
</project>