update version of checkstyle for latest google style and jdk 8
[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
6    Licensed under the Apache License, Version 2.0 (the "License");
7    you may not use this file except in compliance with the License.
8    You may obtain a copy of the License at
9
10        http://www.apache.org/licenses/LICENSE-2.0
11
12    Unless required by applicable law or agreed to in writing, software
13    distributed under the License is distributed on an "AS IS" BASIS,
14    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15    See the License for the specific language governing permissions and
16    limitations under the License.
17 -->
18 <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">
19   <modelVersion>4.0.0</modelVersion>
20   <parent>
21     <groupId>org.onap.oparent</groupId>
22     <artifactId>version</artifactId>
23     <version>3.0.0-SNAPSHOT</version>
24     <relativePath>..</relativePath>
25   </parent>
26   <artifactId>oparent</artifactId>
27   <name>oparent/oparent</name>
28   <packaging>pom</packaging>
29   <scm>
30     <connection>scm:git:ssh://git.onap.org:29418/oparent.git</connection>
31     <developerConnection>scm:git:ssh://git.onap.org:29418/oparent.git</developerConnection>
32     <tag>HEAD</tag>
33     <url>https://wiki.onap.org/display/DW/Integration+Project</url>
34   </scm>
35   <properties>
36     <jacoco.version>0.8.2</jacoco.version>
37     <sonar-jacoco-listeners.version>3.2</sonar-jacoco-listeners.version>
38     <sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
39     <!-- Default Sonar configuration -->
40     <sonar.jacoco.reportPath>target/code-coverage/jacoco-ut.exec</sonar.jacoco.reportPath>
41     <sonar.jacoco.itReportPath>target/code-coverage/jacoco-it.exec</sonar.jacoco.itReportPath>
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     <profile>
277       <activation>
278         <jdk>[1.8,)</jdk>
279       </activation>
280       <!-- overrides oparent's existing checkstyle to check java 8 code -->
281       <id>checkstyle-jdk8</id>
282       <build>
283         <plugins>
284           <plugin>
285             <!--
286               - override the original oparent checkstyle configuration to
287               - use a later version of checkstyle which is jdk8 aware, and
288               - use an updated checkstyle config that conforms to onap style and the later checkstyle format.
289               -->
290             <artifactId>maven-checkstyle-plugin</artifactId>
291             <version>3.1.0</version>
292             <dependencies>
293               <dependency>
294                 <!-- because google's latest style is not supported by plugin's default  version-->
295                 <groupId>com.puppycrawl.tools</groupId>
296                 <artifactId>checkstyle</artifactId>
297                 <version>8.24</version>
298               </dependency>
299             </dependencies>
300             <executions>
301               <execution>
302                 <id>onap-license</id>
303                 <configuration>
304                   <!-- this config not supported by checkstyle any more -->
305                   <sourceDirectory combine.self="override"/>
306                   <sourceDirectories>
307                     <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
308                   </sourceDirectories>
309                 </configuration>
310               </execution>
311               <execution>
312                 <id>onap-java-style</id>
313                 <configuration>
314                   <!-- Use Google Java Style Guide:
315                      https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml
316                      with minor changes -->
317                   <configLocation>onap-checkstyle/onap-java-style${maven.compiler.source}.xml</configLocation>
318                   <!-- this config not supported by checkstyle any more -->
319                   <sourceDirectory combine.self="override"/>
320                   <sourceDirectories>
321                     <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
322                   </sourceDirectories>
323                 </configuration>
324               </execution>
325             </executions>
326           </plugin>
327         </plugins>
328       </build>
329     </profile>
330   </profiles>
331   <dependencyManagement>
332     <dependencies>
333       <dependency>
334         <groupId>org.onap.oparent</groupId>
335         <artifactId>dependencies</artifactId>
336         <version>3.0.0-SNAPSHOT</version>
337         <type>pom</type>
338         <scope>import</scope>
339       </dependency>
340     </dependencies>
341   </dependencyManagement>
342   <build>
343     <pluginManagement>
344       <plugins>
345         <plugin>
346           <groupId>org.jacoco</groupId>
347           <artifactId>jacoco-maven-plugin</artifactId>
348           <version>${jacoco.version}</version>
349           <configuration>
350             <!-- Note: This exclusion list should match <sonar.exclusions>
351          property above -->
352             <excludes>
353               <exclude>**/gen/**</exclude>
354               <exclude>**/generated-sources/**</exclude>
355               <exclude>**/yang-gen/**</exclude>
356               <exclude>**/pax/**</exclude>
357             </excludes>
358           </configuration>
359           <executions>
360             <!--
361         Prepares the property pointing to the JaCoCo runtime agent which
362         is passed as VM argument when Maven the Surefire plugin is executed.
363         -->
364             <execution>
365               <id>pre-unit-test</id>
366               <goals>
367                 <goal>prepare-agent</goal>
368               </goals>
369               <configuration>
370                 <!-- Sets the path to the file which contains the execution data. -->
371                 <destFile>${project.build.directory}/code-coverage/jacoco-ut.exec</destFile>
372                 <!--
373             Sets the name of the property containing the settings
374             for JaCoCo runtime agent.
375         -->
376                 <propertyName>surefireArgLine</propertyName>
377               </configuration>
378             </execution>
379             <!--
380         Ensures that the code coverage report for unit tests is created after
381         unit tests have been run.
382         -->
383             <execution>
384               <id>post-unit-test</id>
385               <phase>test</phase>
386               <goals>
387                 <goal>report</goal>
388               </goals>
389               <configuration>
390                 <!-- Sets the path to the file which contains the execution data. -->
391                 <dataFile>${project.build.directory}/code-coverage/jacoco-ut.exec</dataFile>
392                 <!-- Sets the output directory for the code coverage report. -->
393                 <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
394               </configuration>
395             </execution>
396             <execution>
397               <id>pre-integration-test</id>
398               <phase>pre-integration-test</phase>
399               <goals>
400                 <goal>prepare-agent</goal>
401               </goals>
402               <configuration>
403                 <!-- Sets the path to the file which contains the execution data. -->
404                 <destFile>${project.build.directory}/code-coverage/jacoco-it.exec</destFile>
405                 <!--
406             Sets the name of the property containing the settings
407             for JaCoCo runtime agent.
408         -->
409                 <propertyName>failsafeArgLine</propertyName>
410               </configuration>
411             </execution>
412             <!--
413         Ensures that the code coverage report for integration tests after
414         integration tests have been run.
415         -->
416             <execution>
417               <id>post-integration-test</id>
418               <phase>post-integration-test</phase>
419               <goals>
420                 <goal>report</goal>
421               </goals>
422               <configuration>
423                 <!-- Sets the path to the file which contains the execution data. -->
424                 <dataFile>${project.build.directory}/code-coverage/jacoco-it.exec</dataFile>
425                 <!-- Sets the output directory for the code coverage report. -->
426                 <outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>
427               </configuration>
428             </execution>
429           </executions>
430         </plugin>
431         <plugin>
432           <groupId>org.apache.maven.plugins</groupId>
433           <artifactId>maven-surefire-plugin</artifactId>
434           <version>2.22.0</version>
435           <configuration>
436             <!-- Sets the VM argument line used when unit tests are run. -->
437             <argLine>${surefireArgLine}</argLine>
438             <!-- Excludes integration tests when unit tests are run. -->
439             <excludes>
440               <exclude>**/IT*.java</exclude>
441             </excludes>
442           </configuration>
443         </plugin>
444         <plugin>
445           <groupId>org.apache.maven.plugins</groupId>
446           <artifactId>maven-failsafe-plugin</artifactId>
447           <version>2.22.0</version>
448           <executions>
449             <!--
450         Ensures that both integration-test and verify goals of the Failsafe Maven
451         plugin are executed.
452         -->
453             <execution>
454               <id>integration-tests</id>
455               <goals>
456                 <goal>integration-test</goal>
457                 <goal>verify</goal>
458               </goals>
459               <configuration>
460                 <!-- Sets the VM argument line used when integration tests are run. -->
461                 <argLine>${failsafeArgLine}</argLine>
462               </configuration>
463             </execution>
464           </executions>
465         </plugin>
466         <!-- https://mvnrepository.com/artifact/org.sonarsource.scanner.maven/sonar-maven-plugin -->
467         <plugin>
468           <groupId>org.sonarsource.scanner.maven</groupId>
469           <artifactId>sonar-maven-plugin</artifactId>
470           <version>3.2</version>
471         </plugin>
472       </plugins>
473     </pluginManagement>
474     <plugins>
475       <plugin>
476         <artifactId>maven-checkstyle-plugin</artifactId>
477         <version>2.17</version>
478         <dependencies>
479           <dependency>
480             <groupId>org.onap.oparent</groupId>
481             <artifactId>checkstyle</artifactId>
482             <version>3.0.0-SNAPSHOT</version>
483           </dependency>
484         </dependencies>
485         <executions>
486           <execution>
487             <id>onap-license</id>
488             <goals>
489               <goal>check</goal>
490             </goals>
491             <phase>process-sources</phase>
492             <configuration>
493               <configLocation>onap-checkstyle/check-license.xml</configLocation>
494               <includeResources>false</includeResources>
495               <includeTestSourceDirectory>true</includeTestSourceDirectory>
496               <includeTestResources>false</includeTestResources>
497               <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
498               <excludes>
499               </excludes>
500               <consoleOutput>true</consoleOutput>
501               <failsOnViolation>false</failsOnViolation>
502             </configuration>
503           </execution>
504           <execution>
505             <id>onap-java-style</id>
506             <goals>
507               <goal>check</goal>
508             </goals>
509             <phase>process-sources</phase>
510             <configuration>
511               <!-- Use Google Java Style Guide:
512                    https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml
513                    with minor changes -->
514               <configLocation>onap-checkstyle/onap-java-style.xml</configLocation>
515               <!-- <sourceDirectory> is needed so that checkstyle ignores the generated sources directory -->
516               <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
517               <includeResources>true</includeResources>
518               <includeTestSourceDirectory>true</includeTestSourceDirectory>
519               <includeTestResources>true</includeTestResources>
520               <excludes>
521               </excludes>
522               <consoleOutput>true</consoleOutput>
523               <failsOnViolation>false</failsOnViolation>
524             </configuration>
525           </execution>
526         </executions>
527       </plugin>
528       <plugin>
529         <groupId>org.codehaus.mojo</groupId>
530         <artifactId>build-helper-maven-plugin</artifactId>
531         <version>1.12</version>
532       </plugin>
533       <!-- Jacoco / Sonar -->
534       <plugin>
535         <groupId>org.jacoco</groupId>
536         <artifactId>jacoco-maven-plugin</artifactId>
537       </plugin>
538       <plugin>
539         <groupId>org.apache.maven.plugins</groupId>
540         <artifactId>maven-surefire-plugin</artifactId>
541       </plugin>
542       <plugin>
543         <groupId>org.apache.maven.plugins</groupId>
544         <artifactId>maven-failsafe-plugin</artifactId>
545       </plugin>
546     </plugins>
547   </build>
548 </project>