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