Upgrade checkstyle to version 8.32 Google style
[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>generate-json</id>
52       <activation>
53         <file>
54           <exists>${swagger-properties}</exists>
55         </file>
56         <property>
57           <name>swagger-sdk.generate-json</name>
58         </property>
59       </activation>
60       <build>
61         <plugins>
62           <plugin>
63             <groupId>org.codehaus.mojo</groupId>
64             <artifactId>properties-maven-plugin</artifactId>
65             <version>1.0.0</version>
66             <executions>
67               <execution>
68                 <phase>initialize</phase>
69                 <goals>
70                   <goal>read-project-properties</goal>
71                 </goals>
72                 <configuration>
73                   <files>
74                     <file>${basedir}/src/main/resources/swagger.properties</file>
75                   </files>
76                 </configuration>
77               </execution>
78             </executions>
79           </plugin>
80           <plugin>
81             <groupId>com.github.kongchen</groupId>
82             <artifactId>swagger-maven-plugin</artifactId>
83             <version>3.1.4</version>
84             <configuration>
85               <apiSources>
86                 <apiSource>
87                   <locations>${api-rest-package}</locations>
88                   <schemes>http,https</schemes>
89                   <host>${api-host-ip}:${api-host-port}</host>
90                   <basePath>${api-base-path}</basePath>
91                   <info>
92                     <title>${api-title}</title>
93                     <version>${api-version}</version>
94                     <description>${api-description}</description>
95                     <license>
96                       <name>${api-license}</name>
97                     </license>
98                   </info>
99                   <swaggerDirectory>${basedir}/src/main/resources</swaggerDirectory>
100                 </apiSource>
101               </apiSources>
102             </configuration>
103             <executions>
104               <execution>
105                 <phase>compile</phase>
106                 <goals>
107                   <goal>generate</goal>
108                 </goals>
109               </execution>
110             </executions>
111           </plugin>
112           <plugin>
113             <groupId>org.apache.maven.plugins</groupId>
114             <artifactId>maven-install-plugin</artifactId>
115             <version>2.3.1</version>
116             <executions>
117               <execution>
118                 <id>install-file-id</id>
119                 <phase>install</phase>
120                 <goals>
121                   <goal>install-file</goal>
122                 </goals>
123                 <configuration>
124                   <file>${basedir}/src/main/resources/swagger.json</file>
125                   <groupId>${project.groupId}</groupId>
126                   <artifactId>${project.artifactId}-swagger-schema</artifactId>
127                   <version>${project.version}</version>
128                   <packaging>json</packaging>
129                 </configuration>
130               </execution>
131             </executions>
132           </plugin>
133         </plugins>
134       </build>
135     </profile>
136     <profile>
137       <id>generate-sdk</id>
138       <activation>
139         <file>
140           <exists>${swagger-json}</exists>
141         </file>
142         <property>
143           <name>swagger-sdk.generate-java-sdk</name>
144         </property>
145       </activation>
146       <build>
147         <plugins>
148           <plugin>
149             <groupId>org.apache.maven.plugins</groupId>
150             <artifactId>maven-antrun-plugin</artifactId>
151             <version>1.8</version>
152             <executions>
153               <execution>
154                 <phase>initialize</phase>
155                 <id>ant-create-script</id>
156                 <configuration>
157                   <exportAntProperties>true</exportAntProperties>
158                   <tasks>
159                     <taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="maven.plugin.classpath"/>
160                     <condition property="is_windows" value="true">
161                       <os family="windows"/>
162                     </condition>
163                     <condition property="isLinux" value="true">
164                       <os family="unix"/>
165                     </condition>
166                     <if>
167                       <equals arg1="${is_windows}" arg2="true"/>
168                       <then>
169                         <property name="swagger.sdk.script.file" value="generated-source-script.bat"/>
170                         <echo file="${project.build.directory}${file.separator}generated-source-script.bat" append="true" message="cd ${project.build.directory}${file.separator}generated-sources${line.separator}"/>
171                         <echo file="${project.build.directory}${file.separator}generated-source-script.bat" append="true" message="mvn clean install -Dmaven.test.skip=true${line.separator}"/>
172                       </then>
173                       <else>
174                         <property name="swagger.sdk.script.file" value="generated-source-script.sh"/>
175                         <echo file="${project.build.directory}${file.separator}generated-source-script.sh" append="true" message="cd ${project.build.directory}${file.separator}generated-sources${line.separator}"/>
176                         <echo file="${project.build.directory}${file.separator}generated-source-script.sh" append="true" message="mvn clean install -Dmaven.test.skip=true${line.separator}"/>
177                         <chmod file="${project.build.directory}${file.separator}generated-source-script.sh" perm="755"/>
178                       </else>
179                     </if>
180                   </tasks>
181                 </configuration>
182                 <goals>
183                   <goal>run</goal>
184                 </goals>
185               </execution>
186             </executions>
187             <dependencies>
188               <dependency>
189                 <groupId>ant-contrib</groupId>
190                 <artifactId>ant-contrib</artifactId>
191                 <version>1.0b3</version>
192                 <exclusions>
193                   <exclusion>
194                     <artifactId>ant</artifactId>
195                     <groupId>ant</groupId>
196                   </exclusion>
197                 </exclusions>
198               </dependency>
199             </dependencies>
200           </plugin>
201           <plugin>
202             <groupId>io.swagger</groupId>
203             <artifactId>swagger-codegen-maven-plugin</artifactId>
204             <version>2.2.1</version>
205             <executions>
206               <execution>
207                 <goals>
208                   <goal>generate</goal>
209                 </goals>
210                 <configuration>
211                   <inputSpec>${basedir}/src/main/resources/swagger.json</inputSpec>
212                   <output>${project.build.directory}/generated-sources</output>
213                   <language>java</language>
214                   <configOptions>
215                     <dateLibrary>joda</dateLibrary>
216                   </configOptions>
217                   <library>jersey2</library>
218                   <groupId>${project.groupId}</groupId>
219                   <artifactId>${project.artifactId}-java-sdk</artifactId>
220                   <artifactVersion>${project.version}</artifactVersion>
221                   <modelPackage>${project.groupId}.${project.artifactId}.client.model</modelPackage>
222                   <apiPackage>${project.groupId}.${project.artifactId}.client.api</apiPackage>
223                   <invokerPackage>${project.groupId}.${project.artifactId}.client.invoker</invokerPackage>
224                 </configuration>
225               </execution>
226             </executions>
227           </plugin>
228           <plugin>
229             <artifactId>exec-maven-plugin</artifactId>
230             <groupId>org.codehaus.mojo</groupId>
231             <version>1.5.0</version>
232             <executions>
233               <execution>
234                 <id>swagger-generate-sources</id>
235                 <phase>generate-sources</phase>
236                 <goals>
237                   <goal>exec</goal>
238                 </goals>
239                 <configuration>
240                   <executable>${project.build.directory}${file.separator}${swagger.sdk.script.file}</executable>
241                 </configuration>
242               </execution>
243             </executions>
244           </plugin>
245           <plugin>
246             <groupId>org.apache.maven.plugins</groupId>
247             <artifactId>maven-clean-plugin</artifactId>
248             <version>3.0.0</version>
249             <executions>
250               <execution>
251                 <id>clean-generated-files</id>
252                 <phase>generate-sources</phase>
253                 <goals>
254                   <goal>clean</goal>
255                 </goals>
256                 <configuration>
257                   <filesets>
258                     <fileset>
259                       <directory>${project.build.directory}/generated-sources</directory>
260                     </fileset>
261                   </filesets>
262                 </configuration>
263               </execution>
264             </executions>
265           </plugin>
266         </plugins>
267       </build>
268       <dependencies>
269         <dependency>
270           <groupId>org.onap.msb.swagger-sdk</groupId>
271           <artifactId>swagger-sdk</artifactId>
272           <version>1.0.0</version>
273         </dependency>
274       </dependencies>
275     </profile>
276   </profiles>
277   <dependencyManagement>
278     <dependencies>
279       <dependency>
280         <groupId>org.onap.oparent</groupId>
281         <artifactId>dependencies</artifactId>
282         <version>3.1.0-SNAPSHOT</version>
283         <type>pom</type>
284         <scope>import</scope>
285       </dependency>
286     </dependencies>
287   </dependencyManagement>
288   <build>
289     <pluginManagement>
290       <plugins>
291         <plugin>
292           <groupId>org.jacoco</groupId>
293           <artifactId>jacoco-maven-plugin</artifactId>
294           <version>${jacoco.version}</version>
295           <configuration>
296             <!-- Note: This exclusion list should match <sonar.exclusions>
297          property above -->
298             <excludes>
299               <exclude>**/gen/**</exclude>
300               <exclude>**/generated-sources/**</exclude>
301               <exclude>**/yang-gen/**</exclude>
302               <exclude>**/pax/**</exclude>
303             </excludes>
304           </configuration>
305           <executions>
306             <!--
307         Prepares the property pointing to the JaCoCo runtime agent which
308         is passed as VM argument when Maven the Surefire plugin is executed.
309         -->
310             <execution>
311               <id>pre-unit-test</id>
312               <goals>
313                 <goal>prepare-agent</goal>
314               </goals>
315               <configuration>
316                 <!-- Sets the path to the file which contains the execution data. -->
317                 <destFile>${project.build.directory}/code-coverage/jacoco-ut.exec</destFile>
318                 <!--
319             Sets the name of the property containing the settings
320             for JaCoCo runtime agent.
321         -->
322                 <propertyName>surefireArgLine</propertyName>
323               </configuration>
324             </execution>
325             <!--
326         Ensures that the code coverage report for unit tests is created after
327         unit tests have been run.
328         -->
329             <execution>
330               <id>post-unit-test</id>
331               <phase>test</phase>
332               <goals>
333                 <goal>report</goal>
334               </goals>
335               <configuration>
336                 <!-- Sets the path to the file which contains the execution data. -->
337                 <dataFile>${project.build.directory}/code-coverage/jacoco-ut.exec</dataFile>
338                 <!-- Sets the output directory for the code coverage report. -->
339                 <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
340               </configuration>
341             </execution>
342             <execution>
343               <id>pre-integration-test</id>
344               <phase>pre-integration-test</phase>
345               <goals>
346                 <goal>prepare-agent</goal>
347               </goals>
348               <configuration>
349                 <!-- Sets the path to the file which contains the execution data. -->
350                 <destFile>${project.build.directory}/code-coverage/jacoco-it.exec</destFile>
351                 <!--
352             Sets the name of the property containing the settings
353             for JaCoCo runtime agent.
354         -->
355                 <propertyName>failsafeArgLine</propertyName>
356               </configuration>
357             </execution>
358             <!--
359         Ensures that the code coverage report for integration tests after
360         integration tests have been run.
361         -->
362             <execution>
363               <id>post-integration-test</id>
364               <phase>post-integration-test</phase>
365               <goals>
366                 <goal>report</goal>
367               </goals>
368               <configuration>
369                 <!-- Sets the path to the file which contains the execution data. -->
370                 <dataFile>${project.build.directory}/code-coverage/jacoco-it.exec</dataFile>
371                 <!-- Sets the output directory for the code coverage report. -->
372                 <outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>
373               </configuration>
374             </execution>
375           </executions>
376         </plugin>
377         <plugin>
378           <groupId>org.apache.maven.plugins</groupId>
379           <artifactId>maven-surefire-plugin</artifactId>
380           <version>3.0.0-M4</version>
381           <configuration>
382             <!-- Sets the VM argument line used when unit tests are run. -->
383             <argLine>${surefireArgLine}</argLine>
384             <!-- Excludes integration tests when unit tests are run. -->
385             <excludes>
386               <exclude>**/IT*.java</exclude>
387             </excludes>
388           </configuration>
389         </plugin>
390         <plugin>
391           <groupId>org.apache.maven.plugins</groupId>
392           <artifactId>maven-failsafe-plugin</artifactId>
393           <version>3.0.0-M4</version>
394           <executions>
395             <!--
396         Ensures that both integration-test and verify goals of the Failsafe Maven
397         plugin are executed.
398         -->
399             <execution>
400               <id>integration-tests</id>
401               <goals>
402                 <goal>integration-test</goal>
403                 <goal>verify</goal>
404               </goals>
405               <configuration>
406                 <!-- Sets the VM argument line used when integration tests are run. -->
407                 <argLine>${failsafeArgLine}</argLine>
408               </configuration>
409             </execution>
410           </executions>
411         </plugin>
412         <!-- https://mvnrepository.com/artifact/org.sonarsource.scanner.maven/sonar-maven-plugin -->
413         <plugin>
414           <groupId>org.sonarsource.scanner.maven</groupId>
415           <artifactId>sonar-maven-plugin</artifactId>
416           <version>${sonar.scanner.version}</version>
417         </plugin>
418         <plugin>
419           <groupId>org.apache.maven.plugins</groupId>
420           <artifactId>maven-checkstyle-plugin</artifactId>
421           <version>3.1.1</version>
422           <dependencies>
423             <dependency>
424               <groupId>com.puppycrawl.tools</groupId>
425               <artifactId>checkstyle</artifactId>
426               <version>8.32</version>
427             </dependency>
428           </dependencies>
429         </plugin>
430       </plugins>
431     </pluginManagement>
432     <plugins>
433       <plugin>
434         <artifactId>maven-checkstyle-plugin</artifactId>
435         <dependencies>
436           <dependency>
437             <groupId>org.onap.oparent</groupId>
438             <artifactId>checkstyle</artifactId>
439             <version>3.1.0-SNAPSHOT</version>
440           </dependency>
441         </dependencies>
442         <executions>
443           <execution>
444             <id>onap-license</id>
445             <goals>
446               <goal>check</goal>
447             </goals>
448             <phase>process-sources</phase>
449             <configuration>
450               <configLocation>onap-checkstyle/check-license.xml</configLocation>
451               <includeResources>false</includeResources>
452               <includeTestSourceDirectory>true</includeTestSourceDirectory>
453               <includeTestResources>false</includeTestResources>
454               <sourceDirectories>
455                 <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
456               </sourceDirectories>
457               <excludes>
458               </excludes>
459               <consoleOutput>true</consoleOutput>
460               <failOnViolation>false</failOnViolation>
461             </configuration>
462           </execution>
463           <execution>
464             <id>onap-java-style</id>
465             <goals>
466               <goal>check</goal>
467             </goals>
468             <phase>process-sources</phase>
469             <configuration>
470               <!-- Use Google Java Style Guide:
471                    https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml
472                    with minor changes -->
473               <configLocation>onap-checkstyle/onap-java-style.xml</configLocation>
474               <!-- <sourceDirectories> is needed so that checkstyle ignores the generated sources directory -->
475               <sourceDirectories>
476                 <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
477               </sourceDirectories>
478               <includeResources>true</includeResources>
479               <includeTestSourceDirectory>true</includeTestSourceDirectory>
480               <includeTestResources>true</includeTestResources>
481               <excludes>
482               </excludes>
483               <consoleOutput>true</consoleOutput>
484               <failOnViolation>false</failOnViolation>
485             </configuration>
486           </execution>
487         </executions>
488       </plugin>
489       <plugin>
490         <groupId>org.codehaus.mojo</groupId>
491         <artifactId>build-helper-maven-plugin</artifactId>
492         <version>1.12</version>
493       </plugin>
494       <!-- Jacoco / Sonar -->
495       <plugin>
496         <groupId>org.jacoco</groupId>
497         <artifactId>jacoco-maven-plugin</artifactId>
498       </plugin>
499       <plugin>
500         <groupId>org.apache.maven.plugins</groupId>
501         <artifactId>maven-surefire-plugin</artifactId>
502       </plugin>
503       <plugin>
504         <groupId>org.apache.maven.plugins</groupId>
505         <artifactId>maven-failsafe-plugin</artifactId>
506       </plugin>
507     </plugins>
508   </build>
509 </project>