0f816eca8921dfca6165c9e3833840c6ecdcd73c
[oparent.git] / oparent / pom.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3    Copyright (c) 2016-2017 Huawei Technologies Co., Ltd.
4    Modifications copyright (C) 2019 AT&T Intellectual Property
5    Modifications Copyright (C) 2019-2020 Nordix Foundation.
6
7    Licensed under the Apache License, Version 2.0 (the "License");
8    you may not use this file except in compliance with the License.
9    You may obtain a copy of the License at
10
11        http://www.apache.org/licenses/LICENSE-2.0
12
13    Unless required by applicable law or agreed to in writing, software
14    distributed under the License is distributed on an "AS IS" BASIS,
15    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16    See the License for the specific language governing permissions and
17    limitations under the License.
18 -->
19 <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">
20   <modelVersion>4.0.0</modelVersion>
21   <parent>
22     <groupId>org.onap.oparent</groupId>
23     <artifactId>version</artifactId>
24     <version>3.1.0-SNAPSHOT</version>
25     <relativePath>..</relativePath>
26   </parent>
27   <artifactId>oparent</artifactId>
28   <name>oparent/oparent</name>
29   <packaging>pom</packaging>
30   <scm>
31     <connection>scm:git:ssh://git.onap.org:29418/oparent.git</connection>
32     <developerConnection>scm:git:ssh://git.onap.org:29418/oparent.git</developerConnection>
33     <tag>HEAD</tag>
34     <url>https://wiki.onap.org/display/DW/Integration+Project</url>
35   </scm>
36   <properties>
37     <jacoco.version>0.8.5</jacoco.version>
38     <sonar-jacoco-listeners.version>3.2</sonar-jacoco-listeners.version>
39     <sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
40     <!-- Default Sonar configuration -->
41     <sonar.coverage.jacoco.xmlReportPaths>${project.reporting.outputDirectory}/jacoco-ut/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
42     <!-- Note: This list should match jacoco-maven-plugin's exclusion list below -->
43     <sonar.exclusions>**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**</sonar.exclusions>
44     <!-- If following file exist, auto-generation of swagger.json will be done -->
45     <swagger-properties>${basedir}/src/main/resources/swagger.properties</swagger-properties>
46     <!-- If following file exist, auto-generation of sdk will be done -->
47     <swagger-json>${basedir}/src/main/resources/swagger.json</swagger-json>
48   </properties>
49   <profiles>
50     <profile>
51         <id>cve</id>
52         <build>
53             <plugins>
54                 <plugin>
55                     <groupId>org.owasp</groupId>
56                     <artifactId>dependency-check-maven</artifactId>
57                     <version>5.3.2</version>
58                     <executions>
59                         <execution>
60                             <goals>
61                                 <goal>check</goal>
62                             </goals>
63                         </execution>
64                     </executions>
65                 </plugin>
66             </plugins>
67         </build>
68     </profile>
69
70     <profile>
71       <id>generate-json</id>
72       <activation>
73         <file>
74           <exists>${swagger-properties}</exists>
75         </file>
76         <property>
77           <name>swagger-sdk.generate-json</name>
78         </property>
79       </activation>
80       <build>
81         <plugins>
82           <plugin>
83             <groupId>org.codehaus.mojo</groupId>
84             <artifactId>properties-maven-plugin</artifactId>
85             <version>1.0.0</version>
86             <executions>
87               <execution>
88                 <phase>initialize</phase>
89                 <goals>
90                   <goal>read-project-properties</goal>
91                 </goals>
92                 <configuration>
93                   <files>
94                     <file>${basedir}/src/main/resources/swagger.properties</file>
95                   </files>
96                 </configuration>
97               </execution>
98             </executions>
99           </plugin>
100           <plugin>
101             <groupId>com.github.kongchen</groupId>
102             <artifactId>swagger-maven-plugin</artifactId>
103             <version>3.1.4</version>
104             <configuration>
105               <apiSources>
106                 <apiSource>
107                   <locations>${api-rest-package}</locations>
108                   <schemes>http,https</schemes>
109                   <host>${api-host-ip}:${api-host-port}</host>
110                   <basePath>${api-base-path}</basePath>
111                   <info>
112                     <title>${api-title}</title>
113                     <version>${api-version}</version>
114                     <description>${api-description}</description>
115                     <license>
116                       <name>${api-license}</name>
117                     </license>
118                   </info>
119                   <swaggerDirectory>${basedir}/src/main/resources</swaggerDirectory>
120                 </apiSource>
121               </apiSources>
122             </configuration>
123             <executions>
124               <execution>
125                 <phase>compile</phase>
126                 <goals>
127                   <goal>generate</goal>
128                 </goals>
129               </execution>
130             </executions>
131           </plugin>
132           <plugin>
133             <groupId>org.apache.maven.plugins</groupId>
134             <artifactId>maven-install-plugin</artifactId>
135             <version>2.3.1</version>
136             <executions>
137               <execution>
138                 <id>install-file-id</id>
139                 <phase>install</phase>
140                 <goals>
141                   <goal>install-file</goal>
142                 </goals>
143                 <configuration>
144                   <file>${basedir}/src/main/resources/swagger.json</file>
145                   <groupId>${project.groupId}</groupId>
146                   <artifactId>${project.artifactId}-swagger-schema</artifactId>
147                   <version>${project.version}</version>
148                   <packaging>json</packaging>
149                 </configuration>
150               </execution>
151             </executions>
152           </plugin>
153         </plugins>
154       </build>
155     </profile>
156     <profile>
157       <id>generate-sdk</id>
158       <activation>
159         <file>
160           <exists>${swagger-json}</exists>
161         </file>
162         <property>
163           <name>swagger-sdk.generate-java-sdk</name>
164         </property>
165       </activation>
166       <build>
167         <plugins>
168           <plugin>
169             <groupId>org.apache.maven.plugins</groupId>
170             <artifactId>maven-antrun-plugin</artifactId>
171             <version>1.8</version>
172             <executions>
173               <execution>
174                 <phase>initialize</phase>
175                 <id>ant-create-script</id>
176                 <configuration>
177                   <exportAntProperties>true</exportAntProperties>
178                   <tasks>
179                     <taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="maven.plugin.classpath"/>
180                     <condition property="is_windows" value="true">
181                       <os family="windows"/>
182                     </condition>
183                     <condition property="isLinux" value="true">
184                       <os family="unix"/>
185                     </condition>
186                     <if>
187                       <equals arg1="${is_windows}" arg2="true"/>
188                       <then>
189                         <property name="swagger.sdk.script.file" value="generated-source-script.bat"/>
190                         <echo file="${project.build.directory}${file.separator}generated-source-script.bat" append="true" message="cd ${project.build.directory}${file.separator}generated-sources${line.separator}"/>
191                         <echo file="${project.build.directory}${file.separator}generated-source-script.bat" append="true" message="mvn clean install -Dmaven.test.skip=true${line.separator}"/>
192                       </then>
193                       <else>
194                         <property name="swagger.sdk.script.file" value="generated-source-script.sh"/>
195                         <echo file="${project.build.directory}${file.separator}generated-source-script.sh" append="true" message="cd ${project.build.directory}${file.separator}generated-sources${line.separator}"/>
196                         <echo file="${project.build.directory}${file.separator}generated-source-script.sh" append="true" message="mvn clean install -Dmaven.test.skip=true${line.separator}"/>
197                         <chmod file="${project.build.directory}${file.separator}generated-source-script.sh" perm="755"/>
198                       </else>
199                     </if>
200                   </tasks>
201                 </configuration>
202                 <goals>
203                   <goal>run</goal>
204                 </goals>
205               </execution>
206             </executions>
207             <dependencies>
208               <dependency>
209                 <groupId>ant-contrib</groupId>
210                 <artifactId>ant-contrib</artifactId>
211                 <version>1.0b3</version>
212                 <exclusions>
213                   <exclusion>
214                     <artifactId>ant</artifactId>
215                     <groupId>ant</groupId>
216                   </exclusion>
217                 </exclusions>
218               </dependency>
219             </dependencies>
220           </plugin>
221           <plugin>
222             <groupId>io.swagger</groupId>
223             <artifactId>swagger-codegen-maven-plugin</artifactId>
224             <version>2.2.1</version>
225             <executions>
226               <execution>
227                 <goals>
228                   <goal>generate</goal>
229                 </goals>
230                 <configuration>
231                   <inputSpec>${basedir}/src/main/resources/swagger.json</inputSpec>
232                   <output>${project.build.directory}/generated-sources</output>
233                   <language>java</language>
234                   <configOptions>
235                     <dateLibrary>joda</dateLibrary>
236                   </configOptions>
237                   <library>jersey2</library>
238                   <groupId>${project.groupId}</groupId>
239                   <artifactId>${project.artifactId}-java-sdk</artifactId>
240                   <artifactVersion>${project.version}</artifactVersion>
241                   <modelPackage>${project.groupId}.${project.artifactId}.client.model</modelPackage>
242                   <apiPackage>${project.groupId}.${project.artifactId}.client.api</apiPackage>
243                   <invokerPackage>${project.groupId}.${project.artifactId}.client.invoker</invokerPackage>
244                 </configuration>
245               </execution>
246             </executions>
247           </plugin>
248           <plugin>
249             <artifactId>exec-maven-plugin</artifactId>
250             <groupId>org.codehaus.mojo</groupId>
251             <version>1.5.0</version>
252             <executions>
253               <execution>
254                 <id>swagger-generate-sources</id>
255                 <phase>generate-sources</phase>
256                 <goals>
257                   <goal>exec</goal>
258                 </goals>
259                 <configuration>
260                   <executable>${project.build.directory}${file.separator}${swagger.sdk.script.file}</executable>
261                 </configuration>
262               </execution>
263             </executions>
264           </plugin>
265           <plugin>
266             <groupId>org.apache.maven.plugins</groupId>
267             <artifactId>maven-clean-plugin</artifactId>
268             <version>3.0.0</version>
269             <executions>
270               <execution>
271                 <id>clean-generated-files</id>
272                 <phase>generate-sources</phase>
273                 <goals>
274                   <goal>clean</goal>
275                 </goals>
276                 <configuration>
277                   <filesets>
278                     <fileset>
279                       <directory>${project.build.directory}/generated-sources</directory>
280                     </fileset>
281                   </filesets>
282                 </configuration>
283               </execution>
284             </executions>
285           </plugin>
286         </plugins>
287       </build>
288       <dependencies>
289         <dependency>
290           <groupId>org.onap.msb.swagger-sdk</groupId>
291           <artifactId>swagger-sdk</artifactId>
292           <version>1.0.0</version>
293         </dependency>
294       </dependencies>
295     </profile>
296   </profiles>
297   <dependencyManagement>
298     <dependencies>
299       <dependency>
300         <groupId>org.onap.oparent</groupId>
301         <artifactId>dependencies</artifactId>
302         <version>3.1.0-SNAPSHOT</version>
303         <type>pom</type>
304         <scope>import</scope>
305       </dependency>
306     </dependencies>
307   </dependencyManagement>
308   <build>
309     <pluginManagement>
310       <plugins>
311         <plugin>
312           <groupId>org.jacoco</groupId>
313           <artifactId>jacoco-maven-plugin</artifactId>
314           <version>${jacoco.version}</version>
315           <configuration>
316             <!-- Note: This exclusion list should match <sonar.exclusions>
317          property above -->
318             <excludes>
319               <exclude>**/gen/**</exclude>
320               <exclude>**/generated-sources/**</exclude>
321               <exclude>**/yang-gen/**</exclude>
322               <exclude>**/pax/**</exclude>
323             </excludes>
324           </configuration>
325           <executions>
326             <!--
327         Prepares the property pointing to the JaCoCo runtime agent which
328         is passed as VM argument when Maven the Surefire plugin is executed.
329         -->
330             <execution>
331               <id>pre-unit-test</id>
332               <goals>
333                 <goal>prepare-agent</goal>
334               </goals>
335               <configuration>
336                 <!-- Sets the path to the file which contains the execution data. -->
337                 <destFile>${project.build.directory}/code-coverage/jacoco-ut.exec</destFile>
338                 <!--
339             Sets the name of the property containing the settings
340             for JaCoCo runtime agent.
341         -->
342                 <propertyName>surefireArgLine</propertyName>
343               </configuration>
344             </execution>
345             <!--
346         Ensures that the code coverage report for unit tests is created after
347         unit tests have been run.
348         -->
349             <execution>
350               <id>post-unit-test</id>
351               <phase>test</phase>
352               <goals>
353                 <goal>report</goal>
354               </goals>
355               <configuration>
356                 <!-- Sets the path to the file which contains the execution data. -->
357                 <dataFile>${project.build.directory}/code-coverage/jacoco-ut.exec</dataFile>
358                 <!-- Sets the output directory for the code coverage report. -->
359                 <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
360               </configuration>
361             </execution>
362             <execution>
363               <id>pre-integration-test</id>
364               <phase>pre-integration-test</phase>
365               <goals>
366                 <goal>prepare-agent</goal>
367               </goals>
368               <configuration>
369                 <!-- Sets the path to the file which contains the execution data. -->
370                 <destFile>${project.build.directory}/code-coverage/jacoco-it.exec</destFile>
371                 <!--
372             Sets the name of the property containing the settings
373             for JaCoCo runtime agent.
374         -->
375                 <propertyName>failsafeArgLine</propertyName>
376               </configuration>
377             </execution>
378             <!--
379         Ensures that the code coverage report for integration tests after
380         integration tests have been run.
381         -->
382             <execution>
383               <id>post-integration-test</id>
384               <phase>post-integration-test</phase>
385               <goals>
386                 <goal>report</goal>
387               </goals>
388               <configuration>
389                 <!-- Sets the path to the file which contains the execution data. -->
390                 <dataFile>${project.build.directory}/code-coverage/jacoco-it.exec</dataFile>
391                 <!-- Sets the output directory for the code coverage report. -->
392                 <outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>
393               </configuration>
394             </execution>
395           </executions>
396         </plugin>
397         <plugin>
398           <groupId>org.apache.maven.plugins</groupId>
399           <artifactId>maven-surefire-plugin</artifactId>
400           <version>3.0.0-M4</version>
401           <configuration>
402             <!-- Sets the VM argument line used when unit tests are run. -->
403             <argLine>${surefireArgLine}</argLine>
404             <!-- Excludes integration tests when unit tests are run. -->
405             <excludes>
406               <exclude>**/IT*.java</exclude>
407             </excludes>
408           </configuration>
409         </plugin>
410         <plugin>
411           <groupId>org.apache.maven.plugins</groupId>
412           <artifactId>maven-failsafe-plugin</artifactId>
413           <version>3.0.0-M4</version>
414           <executions>
415             <!--
416         Ensures that both integration-test and verify goals of the Failsafe Maven
417         plugin are executed.
418         -->
419             <execution>
420               <id>integration-tests</id>
421               <goals>
422                 <goal>integration-test</goal>
423                 <goal>verify</goal>
424               </goals>
425               <configuration>
426                 <!-- Sets the VM argument line used when integration tests are run. -->
427                 <argLine>${failsafeArgLine}</argLine>
428               </configuration>
429             </execution>
430           </executions>
431         </plugin>
432         <!-- https://mvnrepository.com/artifact/org.sonarsource.scanner.maven/sonar-maven-plugin -->
433         <plugin>
434           <groupId>org.sonarsource.scanner.maven</groupId>
435           <artifactId>sonar-maven-plugin</artifactId>
436           <version>${sonar.scanner.version}</version>
437         </plugin>
438         <plugin>
439           <groupId>org.apache.maven.plugins</groupId>
440           <artifactId>maven-checkstyle-plugin</artifactId>
441           <version>3.1.1</version>
442           <dependencies>
443             <dependency>
444               <groupId>com.puppycrawl.tools</groupId>
445               <artifactId>checkstyle</artifactId>
446               <version>8.32</version>
447             </dependency>
448           </dependencies>
449         </plugin>
450       </plugins>
451     </pluginManagement>
452     <plugins>
453       <plugin>
454         <artifactId>maven-checkstyle-plugin</artifactId>
455         <dependencies>
456           <dependency>
457             <groupId>org.onap.oparent</groupId>
458             <artifactId>checkstyle</artifactId>
459             <version>3.1.0-SNAPSHOT</version>
460           </dependency>
461         </dependencies>
462         <executions>
463           <execution>
464             <id>onap-license</id>
465             <goals>
466               <goal>check</goal>
467             </goals>
468             <phase>process-sources</phase>
469             <configuration>
470               <configLocation>onap-checkstyle/check-license.xml</configLocation>
471               <includeResources>false</includeResources>
472               <includeTestSourceDirectory>true</includeTestSourceDirectory>
473               <includeTestResources>false</includeTestResources>
474               <sourceDirectories>
475                 <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
476               </sourceDirectories>
477               <excludes>
478               </excludes>
479               <consoleOutput>true</consoleOutput>
480               <failOnViolation>false</failOnViolation>
481             </configuration>
482           </execution>
483           <execution>
484             <id>onap-java-style</id>
485             <goals>
486               <goal>check</goal>
487             </goals>
488             <phase>process-sources</phase>
489             <configuration>
490               <!-- Use Google Java Style Guide:
491                    https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml
492                    with minor changes -->
493               <configLocation>onap-checkstyle/onap-java-style.xml</configLocation>
494               <!-- <sourceDirectories> is needed so that checkstyle ignores the generated sources directory -->
495               <sourceDirectories>
496                 <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
497               </sourceDirectories>
498               <includeResources>true</includeResources>
499               <includeTestSourceDirectory>true</includeTestSourceDirectory>
500               <includeTestResources>true</includeTestResources>
501               <excludes>
502               </excludes>
503               <consoleOutput>true</consoleOutput>
504               <failOnViolation>false</failOnViolation>
505             </configuration>
506           </execution>
507         </executions>
508       </plugin>
509       <plugin>
510         <groupId>org.codehaus.mojo</groupId>
511         <artifactId>build-helper-maven-plugin</artifactId>
512         <version>1.12</version>
513       </plugin>
514       <!-- Jacoco / Sonar -->
515       <plugin>
516         <groupId>org.jacoco</groupId>
517         <artifactId>jacoco-maven-plugin</artifactId>
518       </plugin>
519       <plugin>
520         <groupId>org.apache.maven.plugins</groupId>
521         <artifactId>maven-surefire-plugin</artifactId>
522       </plugin>
523       <plugin>
524         <groupId>org.apache.maven.plugins</groupId>
525         <artifactId>maven-failsafe-plugin</artifactId>
526       </plugin>
527     </plugins>
528   </build>
529 </project>