Skip to content

Commit 7f401d9

Browse files
committed
Update poms
1 parent 396b00f commit 7f401d9

File tree

2 files changed

+197
-0
lines changed
  • openapi-client-maven-template-demo
  • openapi-client-maven-template

2 files changed

+197
-0
lines changed

openapi-client-maven-template-demo/pom.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
2525

2626
<mainClass>software.xdev.Application</mainClass>
27+
28+
<log4j2-version>2.20.0</log4j2-version>
2729
</properties>
2830

2931
<dependencies>
@@ -32,6 +34,19 @@
3234
<artifactId>openapi-client-maven-template</artifactId>
3335
<version>${project.version}</version>
3436
</dependency>
37+
38+
<!-- Logging -->
39+
<!-- SLF4J comes from Apache Httpclient -->
40+
<dependency>
41+
<groupId>org.apache.logging.log4j</groupId>
42+
<artifactId>log4j-core</artifactId>
43+
<version>${log4j2-version}</version>
44+
</dependency>
45+
<dependency>
46+
<groupId>org.apache.logging.log4j</groupId>
47+
<artifactId>log4j-slf4j-impl</artifactId>
48+
<version>${log4j2-version}</version>
49+
</dependency>
3550
</dependencies>
3651

3752
<build>

openapi-client-maven-template/pom.xml

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@
4747

4848
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
4949
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
50+
51+
<!-- Ignore generated code -->
52+
<sonar.exclusions>
53+
src/generated/**
54+
</sonar.exclusions>
5055
</properties>
5156

5257
<repositories>
@@ -84,6 +89,60 @@
8489
</repository>
8590
</distributionManagement>
8691

92+
<dependencyManagement>
93+
<dependencies>
94+
<dependency>
95+
<groupId>com.fasterxml.jackson</groupId>
96+
<artifactId>jackson-bom</artifactId>
97+
<version>2.15.2</version>
98+
<type>pom</type>
99+
<scope>import</scope>
100+
</dependency>
101+
</dependencies>
102+
</dependencyManagement>
103+
104+
<dependencies>
105+
<!-- HTTP client: apache client -->
106+
<dependency>
107+
<groupId>org.apache.httpcomponents.client5</groupId>
108+
<artifactId>httpclient5</artifactId>
109+
<version>5.2.1</version>
110+
</dependency>
111+
112+
<!-- JSON processing: jackson -->
113+
<dependency>
114+
<groupId>com.fasterxml.jackson.core</groupId>
115+
<artifactId>jackson-core</artifactId>
116+
</dependency>
117+
<dependency>
118+
<groupId>com.fasterxml.jackson.core</groupId>
119+
<artifactId>jackson-annotations</artifactId>
120+
</dependency>
121+
<dependency>
122+
<groupId>com.fasterxml.jackson.core</groupId>
123+
<artifactId>jackson-databind</artifactId>
124+
</dependency>
125+
<dependency>
126+
<groupId>com.fasterxml.jackson.jaxrs</groupId>
127+
<artifactId>jackson-jaxrs-json-provider</artifactId>
128+
</dependency>
129+
<dependency>
130+
<groupId>com.fasterxml.jackson.datatype</groupId>
131+
<artifactId>jackson-datatype-jsr310</artifactId>
132+
</dependency>
133+
<dependency>
134+
<groupId>org.openapitools</groupId>
135+
<artifactId>jackson-databind-nullable</artifactId>
136+
<version>0.2.6</version>
137+
</dependency>
138+
139+
<dependency>
140+
<groupId>jakarta.annotation</groupId>
141+
<artifactId>jakarta.annotation-api</artifactId>
142+
<version>2.1.1</version>
143+
</dependency>
144+
</dependencies>
145+
87146
<build>
88147
<plugins>
89148
<plugin>
@@ -158,6 +217,25 @@
158217
</execution>
159218
</executions>
160219
</plugin>
220+
221+
<plugin>
222+
<groupId>org.codehaus.mojo</groupId>
223+
<artifactId>build-helper-maven-plugin</artifactId>
224+
<version>3.4.0</version>
225+
<executions>
226+
<execution>
227+
<phase>generate-sources</phase>
228+
<goals>
229+
<goal>add-source</goal>
230+
</goals>
231+
<configuration>
232+
<sources>
233+
<source>src/generated/java</source>
234+
</sources>
235+
</configuration>
236+
</execution>
237+
</executions>
238+
</plugin>
161239
</plugins>
162240
</build>
163241
<profiles>
@@ -204,5 +282,109 @@
204282
</plugins>
205283
</build>
206284
</profile>
285+
<profile>
286+
<id>openapi-generator</id>
287+
<properties>
288+
<basePackage>software.xdev.INSERT_NAME_HERE</basePackage>
289+
290+
<generatedDirRelative>src/generated/java</generatedDirRelative>
291+
<generatedDir>${project.basedir}/${generatedDirRelative}</generatedDir>
292+
<openApiRelativeGeneratorDir>src/gen</openApiRelativeGeneratorDir>
293+
<openApiGeneratorDir>
294+
${project.basedir}/target/generated-sources/openapi/${openApiRelativeGeneratorDir}
295+
</openApiGeneratorDir>
296+
</properties>
297+
<build>
298+
<plugins>
299+
<plugin>
300+
<groupId>org.apache.maven.plugins</groupId>
301+
<artifactId>maven-clean-plugin</artifactId>
302+
<version>3.3.1</version>
303+
<executions>
304+
<execution>
305+
<id>pre-generation-clean</id>
306+
<phase>initialize</phase>
307+
<goals>
308+
<goal>clean</goal>
309+
</goals>
310+
<configuration>
311+
<excludeDefaultDirectories>true</excludeDefaultDirectories>
312+
<filesets>
313+
<fileset>
314+
<directory>${generatedDir}</directory>
315+
</fileset>
316+
</filesets>
317+
</configuration>
318+
</execution>
319+
<execution>
320+
<id>post-generation-clean</id>
321+
<phase>process-resources</phase>
322+
<goals>
323+
<goal>clean</goal>
324+
</goals>
325+
</execution>
326+
</executions>
327+
</plugin>
328+
<plugin>
329+
<groupId>org.openapitools</groupId>
330+
<artifactId>openapi-generator-maven-plugin</artifactId>
331+
<version>6.6.0</version>
332+
<executions>
333+
<execution>
334+
<goals>
335+
<goal>generate</goal>
336+
</goals>
337+
<configuration>
338+
<inputSpec>${project.basedir}/../openapi/openapi.yml</inputSpec>
339+
<generatorName>java</generatorName>
340+
<configOptions>
341+
<sourceFolder>${openApiRelativeGeneratorDir}</sourceFolder>
342+
<library>apache-httpclient</library>
343+
<apiPackage>${basePackage}.api</apiPackage>
344+
<modelPackage>${basePackage}.model</modelPackage>
345+
<invokerPackage>${basePackage}.client</invokerPackage>
346+
<!-- Otherwise throw and catch everywhere -->
347+
<useRuntimeException>true</useRuntimeException>
348+
<!-- Some fields of API have been ignored because they are unused -->
349+
<disallowAdditionalPropertiesIfNotPresent>false
350+
</disallowAdditionalPropertiesIfNotPresent>
351+
<!-- Use newer Jakarta EE instead of Javax -->
352+
<useJakartaEe>true</useJakartaEe>
353+
<hideGenerationTimestamp>true</hideGenerationTimestamp>
354+
<!-- No tests and documentation because we don't use that -->
355+
<generateModelTests>false</generateModelTests>
356+
<generateApiTests>false</generateApiTests>
357+
<generateModelDocumentation>false</generateModelDocumentation>
358+
<generateApiDocumentation>false</generateApiDocumentation>
359+
</configOptions>
360+
</configuration>
361+
</execution>
362+
</executions>
363+
</plugin>
364+
<plugin>
365+
<groupId>org.apache.maven.plugins</groupId>
366+
<artifactId>maven-resources-plugin</artifactId>
367+
<version>3.3.1</version>
368+
<executions>
369+
<execution>
370+
<id>copy-generated-resources</id>
371+
<phase>process-sources</phase>
372+
<goals>
373+
<goal>copy-resources</goal>
374+
</goals>
375+
<configuration>
376+
<outputDirectory>${generatedDir}</outputDirectory>
377+
<resources>
378+
<resource>
379+
<directory>${openApiGeneratorDir}</directory>
380+
</resource>
381+
</resources>
382+
</configuration>
383+
</execution>
384+
</executions>
385+
</plugin>
386+
</plugins>
387+
</build>
388+
</profile>
207389
</profiles>
208390
</project>

0 commit comments

Comments
 (0)