Add build helper for major/minor versions
[aai/gizmo.git] / pom.xml
diff --git a/pom.xml b/pom.xml
index fba2123..e60005b 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -25,18 +25,26 @@ limitations under the License.
     <parent>
         <groupId>org.onap.oparent</groupId>
         <artifactId>oparent</artifactId>
-        <version>1.2.0</version>
+        <version>2.0.0</version>
         <relativePath />
     </parent>
 
     <groupId>org.onap.aai.gizmo</groupId>
     <artifactId>gizmo</artifactId>
-    <version>1.3.0-SNAPSHOT</version>
+    <version>1.6.0-SNAPSHOT</version>
     <name>aai-gizmo</name>
 
     <properties>
         <docker.location>${basedir}/target</docker.location>
-        <version.org.onap.aai.aai-common>1.2.4</version.org.onap.aai.aai-common>
+        <version.org.onap.aai.aai-schema-ingest>1.4.1</version.org.onap.aai.aai-schema-ingest>
+        <version.org.onap.aai.aai-schema>1.5.1</version.org.onap.aai.aai-schema>
+        <version.org.onap.aai.aai-utils>1.5.3</version.org.onap.aai.aai-utils>
+        <version.org.onap.aai.aai-auth>1.5.3</version.org.onap.aai.aai-auth>
+        <event.client.version>1.5.0</event.client.version>
+        <!-- Minimum code coverage percentage. Please update this figure as coverage increases to prevent any drops in
+         coverage caused by new changes. Note that this figure cannot be lower than the ONAP requirement of 0.55 -->
+        <jacoco.line.coverage.limit>0.60</jacoco.line.coverage.limit>
+        <jacoco.report.directory>${project.build.directory}/code-coverage</jacoco.report.directory>
     </properties>
 
     <dependencyManagement>
@@ -45,7 +53,7 @@ limitations under the License.
                 <!-- Import dependency management from Spring Boot -->
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-dependencies</artifactId>
-                <version>1.5.15.RELEASE</version>
+                <version>1.5.21.RELEASE</version>
                 <type>pom</type>
                 <scope>import</scope>
             </dependency>
@@ -56,6 +64,12 @@ limitations under the License.
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-web</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-tomcat</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
@@ -74,6 +88,12 @@ limitations under the License.
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-jersey</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-tomcat</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
@@ -87,6 +107,7 @@ limitations under the License.
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
@@ -94,44 +115,57 @@ limitations under the License.
             <version>3.2.5</version>
         </dependency>
 
+
+     <dependency>
+         <groupId>io.swagger</groupId>
+         <artifactId>swagger-jersey2-jaxrs</artifactId>
+         <version>1.5.8</version>
+      </dependency>
+      <dependency>
+         <groupId>io.springfox</groupId>
+         <artifactId>springfox-swagger2</artifactId>
+         <version>2.9.2</version>
+      </dependency>
+            <dependency>
+         <groupId>io.springfox</groupId>
+         <artifactId>springfox-swagger-ui</artifactId>
+         <version>2.9.2</version>
+      </dependency>
+
+
         <!-- ONAP AAI-COMMON (incl. model) -->
         <dependency>
-            <groupId>org.onap.aai.aai-common</groupId>
+            <groupId>org.onap.aai.schema-service</groupId>
             <artifactId>aai-schema</artifactId>
-            <version>${version.org.onap.aai.aai-common}</version>
+            <version>${version.org.onap.aai.aai-schema}</version>
         </dependency>
         <dependency>
             <groupId>org.onap.aai.aai-common</groupId>
             <artifactId>aai-schema-ingest</artifactId>
-            <version>${version.org.onap.aai.aai-common}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.aai.aai-common</groupId>
-            <artifactId>aai-core</artifactId>
-            <version>${version.org.onap.aai.aai-common}</version>
+            <version>${version.org.onap.aai.aai-schema-ingest}</version>
             <exclusions>
                 <exclusion>
-                    <groupId>*</groupId>
-                    <artifactId>*</artifactId>
+                  <groupId>org.powermock</groupId>
+                  <artifactId>*</artifactId>
                 </exclusion>
             </exclusions>
         </dependency>
         <dependency>
             <groupId>org.onap.aai.aai-common</groupId>
             <artifactId>aai-utils</artifactId>
-            <version>${version.org.onap.aai.aai-common}</version>
+            <version>${version.org.onap.aai.aai-utils}</version>
         </dependency>
         <dependency>
             <groupId>org.onap.aai.aai-common</groupId>
             <artifactId>aai-auth</artifactId>
-            <version>${version.org.onap.aai.aai-common}</version>
+            <version>${version.org.onap.aai.aai-auth}</version>
         </dependency>
 
         <!-- ONAP EVENT CLIENT -->
         <dependency>
             <groupId>org.onap.aai.event-client</groupId>
             <artifactId>event-client-dmaap</artifactId>
-            <version>1.2.2</version>
+           <version>${event.client.version}</version>
             <exclusions>
                 <exclusion>
                     <groupId>org.slf4j</groupId>
@@ -142,7 +176,19 @@ limitations under the License.
         <dependency>
             <groupId>org.onap.aai.event-client</groupId>
             <artifactId>event-client-kafka</artifactId>
-            <version>1.2.2</version>
+           <version>${event.client.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-api</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <dependency>
+           <groupId>org.onap.aai.event-client</groupId>
+           <artifactId>event-client-rabbitmq</artifactId>
+           <version>${event.client.version}</version>
             <exclusions>
                 <exclusion>
                     <groupId>org.slf4j</groupId>
@@ -176,7 +222,7 @@ limitations under the License.
         <dependency>
             <groupId>org.onap.aai</groupId>
             <artifactId>rest-client</artifactId>
-            <version>1.2.1</version>
+            <version>1.5.0</version>
         </dependency>
 
         <dependency>
@@ -306,7 +352,7 @@ limitations under the License.
         <dependency>
             <groupId>org.mockito</groupId>
             <artifactId>mockito-core</artifactId>
-            <version>1.10.19</version>
+            <version>2.15.0</version>
             <scope>test</scope>
             <exclusions>
                 <exclusion>
@@ -320,6 +366,39 @@ limitations under the License.
     <build>
         <finalName>${project.artifactId}</finalName>
         <plugins>
+            <!--
+            Using https://code.revelc.net/formatter-maven-plugin/ for Eclipse formatter
+            Using https://github.com/diffplug/spotless/tree/master/plugin-maven for import order
+            Use in combination to rewrite code and imports, then checkstyle
+
+            mvn formatter:format spotless:apply process-sources
+            -->
+            <plugin>
+                 <groupId>net.revelc.code.formatter</groupId>
+                 <artifactId>formatter-maven-plugin</artifactId>
+                 <version>2.8.1</version>
+                 <configuration>
+                    <configFile>${project.basedir}/onap-java-formatter.xml</configFile>
+                 </configuration>
+                 <!-- https://code.revelc.net/formatter-maven-plugin/
+                      use mvn formatter:format to rewrite source files
+                      use mvn formatter:validate to validate source files -->
+             </plugin>
+            <plugin>
+              <groupId>com.diffplug.spotless</groupId>
+              <artifactId>spotless-maven-plugin</artifactId>
+              <version>1.18.0</version>
+              <configuration>
+                <java>
+                 <importOrder>
+                   <order>com,java,javax,org</order>
+                 </importOrder>
+                </java>
+              </configuration>
+            <!-- https://github.com/diffplug/spotless/tree/master/plugin-maven
+                 use mvn spotless:apply to rewrite source files
+                 use mvn spotless:check to validate source files -->
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-resources-plugin</artifactId>
@@ -369,6 +448,8 @@ limitations under the License.
                     <dockerDirectory>${docker.location}</dockerDirectory>
                     <imageTags>
                         <imageTag>latest</imageTag>
+                       <tag>${project.docker.latesttag.version}</tag>
+                       <tag>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-${maven.build.timestamp}</tag>
                     </imageTags>
                     <forceTags>true</forceTags>
                 </configuration>
@@ -424,9 +505,6 @@ limitations under the License.
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-deploy-plugin</artifactId>
-                <configuration>
-                    <skip>true</skip>
-                </configuration>
             </plugin>
             <plugin>
                 <groupId>org.springframework.boot</groupId>
@@ -453,20 +531,11 @@ limitations under the License.
                         <configuration>
                             <artifactItems>
                                 <artifactItem>
-                                    <groupId>org.onap.aai.aai-common</groupId>
+                                    <groupId>org.onap.aai.schema-service</groupId>
                                     <artifactId>aai-schema</artifactId>
-                                    <version>${version.org.onap.aai.aai-common}</version>
-                                    <type>jar</type>
-                                    <includes>oxm/</includes>
-                                    <outputDirectory>${project.build.directory}/bundleconfig-local/etc</outputDirectory>
-                                </artifactItem>
-                                <artifactItem>
-                                    <groupId>org.onap.aai.aai-common</groupId>
-                                    <artifactId>aai-core</artifactId>
-                                    <version>${version.org.onap.aai.aai-common}</version>
+                                    <version>${version.org.onap.aai.aai-schema}</version>
                                     <type>jar</type>
-                                    <includes>dbedgerules/</includes>
-                                    <excludes>**/*.ftlh</excludes>
+                                    <includes>onap/**/</includes>
                                     <outputDirectory>${project.build.directory}/bundleconfig-local/etc</outputDirectory>
                                 </artifactItem>
                             </artifactItems>
@@ -474,9 +543,50 @@ limitations under the License.
                     </execution>
                 </executions>
             </plugin>
-        </plugins>
+            <plugin>
+                <groupId>org.jacoco</groupId>
+                <artifactId>jacoco-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>default-check</id>
+                        <goals>
+                            <goal>check</goal>
+                        </goals>
+                        <configuration>
+                            <dataFile>${jacoco.report.directory}/jacoco-ut.exec</dataFile>
+                            <rules>
+                                <!--  implementation is needed only for Maven 2  -->
+                                <rule implementation="org.jacoco.maven.RuleConfiguration">
+                                    <element>BUNDLE</element>
+                                    <limits>
+                                        <limit implementation="org.jacoco.report.check.Limit">
+                                            <counter>LINE</counter>
+                                            <value>COVEREDRATIO</value>
+                                            <minimum>${jacoco.line.coverage.limit}</minimum>
+                                        </limit>
+                                    </limits>
+                                </rule>
+                            </rules>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+           <plugin>
+             <groupId>org.codehaus.mojo</groupId>
+             <artifactId>build-helper-maven-plugin</artifactId>
+              <version>3.0.0</version>
+              <executions>
+               <execution>
+                 <id>parse-version</id>
+                 <goals>
+                   <goal>parse-version</goal>
+                 </goals>
+               </execution>
+              </executions>
+           </plugin>
+       </plugins>
     </build>
-
+    
     <distributionManagement>
         <site>
             <id>ecomp-javadoc</id>