Formatting Code base with ktlint
[ccsdk/cds.git] / pom.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3 Copyright (C) 2019 Bell Canada
4 Modification Copyright © 2018-2019 AT&T Intellectual Property.
5
6 Unless otherwise specified, all software contained herein is licensed
7 under the Apache License, Version 2.0 (the License);
8 you may not use this software except in compliance with the License.
9 You may obtain a copy of the License at
10
11     http://www.apache.org/licenses/LICENSE-2.0
12
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18 -->
19 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
20     <modelVersion>4.0.0</modelVersion>
21
22     <parent>
23         <groupId>org.onap.ccsdk.parent</groupId>
24         <artifactId>spring-boot-starter-parent</artifactId>
25         <version>1.5.0</version>
26         <relativePath/>
27     </parent>
28
29     <groupId>org.onap.ccsdk.cds</groupId>
30     <artifactId>parent</artifactId>
31     <version>0.7.0-SNAPSHOT</version>
32     <packaging>pom</packaging>
33
34     <name>CDS Parent</name>
35     <description>CCSDK Controller Design Studio</description>
36     <url>https://wiki.onap.org</url>
37     <organization>
38         <name>ONAP</name>
39     </organization>
40
41     <modules>
42         <module>ms</module>
43         <module>cds-ui</module>
44         <module>components</module>
45     </modules>
46
47     <properties>
48         <!--Don't set any language to let sonar enable multi-language support-->
49         <sonar.language/>
50         <!--Provide src/main as source path so both src/main/java and src/main/kotlin are scanned-->
51         <sonar.sources>src/main</sonar.sources>
52         <!--Provide src/test as source path for test so both src/test/java and src/test/kotlin are scanned-->
53         <sonar.tests>src/test</sonar.tests>
54         <!--Only include java and kt files to the scan-->
55         <sonar.inclusions>**/*.java,**/*.kt</sonar.inclusions>
56         <!--Specify path to load jacoco XLM report, as Sonar can't load Kotlin coverage from binary report-->
57         <sonar.coverage.jacoco.xmlReportPaths>${project.reporting.outputDirectory}/jacoco-ut/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
58         <jacoco.version>0.8.3</jacoco.version>
59
60         <!-- Properties for POM Format -->
61         <format.skipValidate>false</format.skipValidate>
62         <format.skipExecute>true</format.skipExecute>
63     </properties>
64
65     <build>
66         <plugins>
67             <plugin>
68                 <groupId>org.jacoco</groupId>
69                 <artifactId>jacoco-maven-plugin</artifactId>
70                 <version>${jacoco.version}</version>
71             </plugin>
72
73             <!-- Plugin to Format/Validate POM Files -->
74             <plugin>
75                 <groupId>org.codehaus.mojo</groupId>
76                 <artifactId>tidy-maven-plugin</artifactId>
77                 <version>1.1.0</version>
78                 <executions>
79                     <execution>
80                         <id>format-pom</id>
81                         <phase>process-sources</phase>
82                         <goals>
83                             <goal>pom</goal>
84                         </goals>
85                         <configuration>
86                             <skip>${format.skipExecute}</skip>
87                         </configuration>
88                     </execution>
89                     <execution>
90                         <id>validate-pom</id>
91                         <phase>validate</phase>
92                         <goals>
93                             <goal>check</goal>
94                         </goals>
95                         <configuration>
96                             <skip>${format.skipValidate}</skip>
97                         </configuration>
98                     </execution>
99                 </executions>
100             </plugin>
101
102             <!-- Plugin to Format/Validate Kotlin Files -->
103             <plugin>
104                 <groupId>org.apache.maven.plugins</groupId>
105                 <artifactId>maven-antrun-plugin</artifactId>
106                 <version>1.7</version>
107                 <executions>
108                     <execution>
109                         <id>validate-kotlin</id>
110                         <phase>validate</phase>
111                         <configuration>
112                             <target name="ktlint">
113                                 <java taskname="ktlint" dir="${project.basedir}" fork="true" failonerror="true"
114                                       classname="com.pinterest.ktlint.Main" classpathref="maven.plugin.classpath">
115                                     <arg value="src/**/*.kt"/>
116                                 </java>
117                             </target>
118                             <skip>${format.skipValidate}</skip>
119                         </configuration>
120                         <goals>
121                             <goal>run</goal>
122                         </goals>
123                     </execution>
124                     <execution>
125                         <!-- Built-in formatter So that you wouldn't have to fix all style violations by hand.-->
126                         <id>format-kotlin</id>
127                         <phase>process-sources</phase>
128                         <configuration>
129                             <target name="ktlint">
130                                 <java taskname="ktlint" dir="${project.basedir}" fork="true" failonerror="true"
131                                       classname="com.pinterest.ktlint.Main" classpathref="maven.plugin.classpath">
132                                     <arg value="-F"/>
133                                     <arg value="src/**/*.kt"/>
134                                 </java>
135                             </target>
136                             <skip>${format.skipExecute}</skip>
137                         </configuration>
138                         <goals>
139                             <goal>run</goal>
140                         </goals>
141                     </execution>
142                 </executions>
143                 <dependencies>
144                     <dependency>
145                         <groupId>com.pinterest</groupId>
146                         <artifactId>ktlint</artifactId>
147                         <version>0.35.0</version>
148                     </dependency>
149                 </dependencies>
150             </plugin>
151         </plugins>
152     </build>
153
154     <profiles>
155         <profile>
156             <id>blackduck</id>
157             <activation>
158                 <property>
159                     <name>blackduck-scan</name>
160                 </property>
161             </activation>
162             <build>
163                 <plugins>
164                     <plugin>
165                         <groupId>com.blackducksoftware.integration</groupId>
166                         <artifactId>hub-maven-plugin</artifactId>
167                         <version>1.4.0</version>
168                         <inherited>false</inherited>
169                         <configuration>
170                             <hubProjectName>${project.name}</hubProjectName>
171                             <outputDirectory>${project.basedir}</outputDirectory>
172                         </configuration>
173                         <executions>
174                             <execution>
175                                 <id>create-bdio-file</id>
176                                 <phase>package</phase>
177                                 <goals>
178                                     <goal>createHubOutput</goal>
179                                 </goals>
180                             </execution>
181                         </executions>
182                     </plugin>
183                 </plugins>
184             </build>
185         </profile>
186
187         <!-- Profile to format skip validate or execute -->
188         <profile>
189             <id>format</id>
190             <properties>
191                 <format.skipValidate>true</format.skipValidate>
192                 <format.skipExecute>false</format.skipExecute>
193             </properties>
194         </profile>
195
196     </profiles>
197 </project>