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