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