db80970c53e5f439c2a4fca1e7aa8d148052e90c
[cps.git] / cps / cps-parent / pom.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <project xmlns="http://maven.apache.org/POM/4.0.0"
3          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5     <parent>
6         <groupId>org.onap.oparent</groupId>
7         <artifactId>oparent</artifactId>
8         <version>3.1.0</version>
9         <relativePath/>
10     </parent>
11     <modelVersion>4.0.0</modelVersion>
12
13     <groupId>org.onap.cps</groupId>
14     <artifactId>cps-parent</artifactId>
15     <version>0.0.1-SNAPSHOT</version>
16     <packaging>pom</packaging>
17
18     <properties>
19         <java.version>11</java.version>
20         <maven-resources-plugin.version>3.2.0</maven-resources-plugin.version>
21         <maven-dependency-plugin.version>3.1.2</maven-dependency-plugin.version>
22         <maven-replacer-plugin.version>1.5.3</maven-replacer-plugin.version>
23         <oparent.version>3.1.0</oparent.version>
24         <spring-boot-maven-plugin.version>2.3.3.RELEASE</spring-boot-maven-plugin.version>
25         <swagger-codegen-maven-plugin.version>3.0.18</swagger-codegen-maven-plugin.version>
26         <swagger-ui.version>3.35.0</swagger-ui.version>
27     </properties>
28
29     <dependencyManagement>
30         <dependencies>
31             <dependency>
32                 <groupId>org.onap.cps</groupId>
33                 <artifactId>cps-dependencies</artifactId>
34                 <version>${project.version}</version>
35                 <type>pom</type>
36                 <scope>import</scope>
37             </dependency>
38             <dependency>
39                 <groupId>org.onap.cps</groupId>
40                 <artifactId>cps-bom</artifactId>
41                 <version>${project.version}</version>
42                 <type>pom</type>
43                 <scope>import</scope>
44             </dependency>
45         </dependencies>
46     </dependencyManagement>
47
48     <build>
49         <resources>
50             <resource>
51                 <directory>src/main/resources</directory>
52                 <filtering>true</filtering>
53             </resource>
54             <resource>
55                 <directory>target/generated-sources/license</directory>
56                 <includes>
57                     <include>third-party-licenses.txt</include>
58                 </includes>
59             </resource>
60             <resource>
61                 <directory>target/generated-resources/licenses</directory>
62                 <includes>
63                     <include>*.*</include>
64                 </includes>
65                 <targetPath>third-party-licenses</targetPath>
66             </resource>
67         </resources>
68         <pluginManagement>
69             <plugins>
70                 <plugin>
71                     <groupId>org.springframework.boot</groupId>
72                     <artifactId>spring-boot-maven-plugin</artifactId>
73                     <version>${spring-boot-maven-plugin.version}</version>
74                     <executions>
75                         <execution>
76                             <goals>
77                                 <goal>repackage</goal>
78                             </goals>
79                         </execution>
80                     </executions>
81                 </plugin>
82                 <!-- Swagger code generation. -->
83                 <plugin>
84                     <groupId>io.swagger.codegen.v3</groupId>
85                     <artifactId>swagger-codegen-maven-plugin</artifactId>
86                     <version>${swagger-codegen-maven-plugin.version}</version>
87                     <executions>
88                         <execution>
89                             <goals>
90                                 <goal>generate</goal>
91                             </goals>
92                             <configuration>
93                                 <inputSpec>${project.basedir}/docs/api/swagger/openapi.yml</inputSpec>
94                                 <invokerPackage>org.onap.cps.rest.controller</invokerPackage>
95                                 <modelPackage>org.onap.cps.rest.model</modelPackage>
96                                 <apiPackage>org.onap.cps.rest.api</apiPackage>
97                                 <language>spring</language>
98                                 <generateSupportingFiles>false</generateSupportingFiles>
99                                 <configOptions>
100                                     <sourceFolder>src/gen/java</sourceFolder>
101                                     <dateLibrary>java11</dateLibrary>
102                                     <interfaceOnly>true</interfaceOnly>
103                                     <useTags>true</useTags>
104                                 </configOptions>
105                             </configuration>
106                         </execution>
107                     </executions>
108                 </plugin>
109                 <plugin>
110                     <!-- Download Swagger UI webjar. -->
111                     <groupId>org.apache.maven.plugins</groupId>
112                     <artifactId>maven-dependency-plugin</artifactId>
113                     <version>${maven-dependency-plugin.version}</version>
114                     <executions>
115                         <execution>
116                             <phase>prepare-package</phase>
117                             <goals>
118                                 <goal>unpack</goal>
119                             </goals>
120                             <configuration>
121                                 <artifactItems>
122                                     <artifactItem>
123                                         <groupId>org.webjars</groupId>
124                                         <artifactId>swagger-ui</artifactId>
125                                         <version>${swagger-ui.version}</version>
126                                     </artifactItem>
127                                 </artifactItems>
128                                 <outputDirectory>
129                                     ${project.build.directory}/swagger-ui-${swagger-ui.version}
130                                 </outputDirectory>
131                             </configuration>
132                         </execution>
133                     </executions>
134                 </plugin>
135                 <plugin>
136                     <!-- Copy Swagger UI resources to static resources directory. -->
137                     <groupId>org.apache.maven.plugins</groupId>
138                     <artifactId>maven-resources-plugin</artifactId>
139                     <version>${maven-resources-plugin.version}</version>
140                     <executions>
141                         <execution>
142                             <id>copy-resources</id>
143                             <phase>prepare-package</phase>
144                             <goals>
145                                 <goal>copy-resources</goal>
146                             </goals>
147                             <configuration>
148                                 <outputDirectory>${project.build.outputDirectory}/static/swagger-ui
149                                 </outputDirectory>
150                                 <resources>
151                                     <resource>
152                                         <directory>
153                                             ${project.build.directory}/swagger-ui-${swagger-ui.version}/META-INF/resources/webjars/swagger-ui/${swagger-ui.version}/
154                                         </directory>
155                                         <excludes>
156                                             <exclude>**/*.gz</exclude>
157                                         </excludes>
158                                     </resource>
159                                 </resources>
160                             </configuration>
161                         </execution>
162                     </executions>
163                 </plugin>
164                 <plugin>
165                     <!-- Replace the OpenAPI specification example URL with the local one. -->
166                     <groupId>com.google.code.maven-replacer-plugin</groupId>
167                     <artifactId>replacer</artifactId>
168                     <version>${maven-replacer-plugin.version}</version>
169                     <executions>
170                         <execution>
171                             <phase>prepare-package</phase>
172                             <goals>
173                                 <goal>replace</goal>
174                             </goals>
175                         </execution>
176                     </executions>
177                     <configuration>
178                         <file>${project.build.outputDirectory}/static/swagger-ui/index.html</file>
179                         <replacements>
180                             <replacement>
181                                 <token>https://petstore.swagger.io/v2/swagger.json</token>
182                                 <value>/api/cps/openapi.json</value>
183                             </replacement>
184                         </replacements>
185                     </configuration>
186                 </plugin>
187             </plugins>
188         </pluginManagement>
189         <plugins>
190             <plugin>
191                 <groupId>org.apache.maven.plugins</groupId>
192                 <artifactId>maven-compiler-plugin</artifactId>
193                 <configuration>
194                     <source>${java.version}</source>
195                     <target>${java.version}</target>
196                 </configuration>
197             </plugin>
198             <plugin>
199                 <groupId>org.apache.maven.plugins</groupId>
200                 <artifactId>maven-checkstyle-plugin</artifactId>
201                 <executions>
202                     <execution>
203                         <id>onap-java-style</id>
204                         <goals>
205                             <goal>check</goal>
206                         </goals>
207                         <phase>process-sources</phase>
208                         <configuration>
209                             <configLocation>onap-checkstyle/onap-java-style.xml</configLocation>
210                             <sourceDirectories>${project.build.sourceDirectory}</sourceDirectories>
211                             <includeResources>true</includeResources>
212                             <includeTestSourceDirectory>true</includeTestSourceDirectory>
213                             <includeTestResources>true</includeTestResources>
214                             <consoleOutput>false</consoleOutput>
215                             <violationSeverity>warning</violationSeverity>
216                             <failOnViolation>true</failOnViolation>
217                         </configuration>
218                     </execution>
219                 </executions>
220                 <dependencies>
221                     <dependency>
222                         <groupId>org.onap.oparent</groupId>
223                         <artifactId>checkstyle</artifactId>
224                         <version>${oparent.version}</version>
225                     </dependency>
226                 </dependencies>
227             </plugin>
228             <!-- Mandatory plugins for using Spock -->
229             <plugin>
230                 <!-- The gmavenplus plugin is used to compile Groovy code.
231                     To learn more about this plugin, visit https://github.com/groovy/GMavenPlus/wiki -->
232                 <groupId>org.codehaus.gmavenplus</groupId>
233                 <artifactId>gmavenplus-plugin</artifactId>
234                 <version>1.9.0</version>
235                 <executions>
236                     <execution>
237                         <goals>
238                             <goal>compileTests</goal>
239                         </goals>
240                     </execution>
241                 </executions>
242             </plugin>
243             <!-- Required because names of spec classes don't match default
244                 Surefire patterns (`*Test` etc.) -->
245             <plugin>
246                 <groupId>org.apache.maven.plugins</groupId>
247                 <artifactId>maven-surefire-plugin</artifactId>
248                 <version>3.0.0-M5</version>
249                 <configuration>
250                     <useFile>false</useFile>
251                     <includes>
252                         <include>**/*Spec.java</include>
253                         <include>**/*Test.java</include> <!-- Just in case of having also "normal" JUnit tests -->
254                     </includes>
255                 </configuration>
256             </plugin>
257         </plugins>
258     </build>
259 </project>