edit POM to push images to nexus repository

Issue-ID: DMAAP-12
Change-Id: I0fb122bcb084da64ba6396aa259d94877d114056
Signed-off-by: ezcoxem <emmett.cox@ericsson.com>
diff --git a/datarouter-node/pom.xml b/datarouter-node/pom.xml
index 95b2aa0..9f5de17 100755
--- a/datarouter-node/pom.xml
+++ b/datarouter-node/pom.xml
@@ -7,9 +7,9 @@
   * Licensed under the Apache License, Version 2.0 (the "License");

   * you may not use this file except in compliance with the License.

   * You may obtain a copy of the License at

-  * 

+  *

    *      http://www.apache.org/licenses/LICENSE-2.0

-  * 

+  *

    * Unless required by applicable law or agreed to in writing, software

   * distributed under the License is distributed on an "AS IS" BASIS,

   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

@@ -196,12 +196,49 @@
 		<profile>

 			<id>docker</id>

 			<properties>

-				<skip.docker.build>false</skip.docker.build>

-				<skip.docker.tag>false</skip.docker.tag>

-				<skip.docker.push>false</skip.docker.push>

+				<skipDockerBuild>false</skipDockerBuild>

+				<skipDockerTag>false</skipDockerTag>

+				<skipTests>true</skipTests>

 			</properties>

+			<build>

+				<plugins>

+					<plugin>

+						<groupId>com.spotify</groupId>

+						<artifactId>docker-maven-plugin</artifactId>

+						<version>1.0.0</version>

+						<configuration>

+							<imageName>${onap.nexus.dockerregistry.daily}/${datarouter.node.image.name}</imageName>

+							<dockerDirectory>${docker.location}</dockerDirectory>

+							<serverId>${onap.nexus.dockerregistry.daily}</serverId>

+							<skipDockerBuild>false</skipDockerBuild>

+							<imageTags>

+								<imageTag>${project.version}</imageTag>

+								<imageTag>latest</imageTag>

+							</imageTags>

+							<forceTags>true</forceTags>

+							<resources>

+								<resource>

+									<targetPath>/</targetPath>

+									<directory>${project.basedir}</directory>

+									<excludes>

+										<exclude>target/**/*</exclude>

+										<exclude>pom.xml</exclude>

+									</excludes>

+								</resource>

+

+								<resource>

+									<targetPath>/</targetPath>

+									<directory>${project.build.directory}</directory>

+									<include>**/**</include>

+								</resource>

+							</resources>

+						</configuration>

+					</plugin>

+				</plugins>

+			</build>

 		</profile>

 	</profiles>

+

 	<build>

 		<finalName>datarouter-node</finalName>

 		<resources>

@@ -330,92 +367,6 @@
 				</executions>

 			</plugin>

 			<plugin>

-				<groupId>com.spotify</groupId>

-				<artifactId>docker-maven-plugin</artifactId>

-				<version>${docker.maven.plugin.version}</version>

-				<configuration>

-					<skipDockerBuild>false</skipDockerBuild>

-					<imageName>${datarouter.node.image.name}</imageName>

-					<dockerDirectory>${docker.location}</dockerDirectory>

-					<serverId>docker-hub</serverId>

-					<imageTags>

-						<imageTag>${project.version}</imageTag>

-						<imageTag>latest</imageTag>

-					</imageTags>

-					<forceTags>true</forceTags>

-					<resources>

-						<resource>

-							<targetPath>/</targetPath>

-							<directory>${docker.location}</directory>

-							<include>${project.build.finalName}.jar</include>

-						</resource>

-						<resource>

-							<targetPath>/</targetPath>

-							<directory>${project.build.directory}</directory>

-							<include>**/**</include>

-						</resource>

-					</resources>

-				</configuration>

-				<executions>

-					<execution>

-						<id>build-image</id>

-						<phase>install</phase>

-						<goals>

-							<goal>build</goal>

-						</goals>

-						<configuration>

-							<skipDockerBuild>${skip.docker.build}</skipDockerBuild>

-						</configuration>

-					</execution>

-					<execution>

-						<id>tag-image-project-version</id>

-						<phase>install</phase>

-						<goals>

-							<goal>tag</goal>

-						</goals>

-						<configuration>

-							<image>${datarouter.node.image.name}</image>

-							<newName>${onap.nexus.dockerregistry.daily}/${datarouter.node.image.name}:${project.version}</newName>

-							<skipDockerTag>${skip.docker.push}</skipDockerTag>

-						</configuration>

-					</execution>

-					<execution>

-						<id>tag-image-latest</id>

-						<phase>install</phase>

-						<goals>

-							<goal>tag</goal>

-						</goals>

-						<configuration>

-							<image>${datarouter.node.image.name}</image>

-							<newName>${onap.nexus.dockerregistry.daily}/${datarouter.node.image.name}:latest</newName>

-							<skipDockerTag>${skip.docker.push}</skipDockerTag>

-						</configuration>

-					</execution>

-					<execution>

-						<id>push-image-latest</id>

-						<phase>deploy</phase>

-						<goals>

-							<goal>push</goal>

-						</goals>

-						<configuration>

-							<imageName>${onap.nexus.dockerregistry.daily}/${datarouter.node.image.name}:${project.version}</imageName>

-							<skipDockerPush>${skip.docker.push}</skipDockerPush>

-						</configuration>

-					</execution>

-					<execution>

-						<id>push-image</id>

-						<phase>deploy</phase>

-						<goals>

-							<goal>push</goal>

-						</goals>

-						<configuration>

-							<imageName>${onap.nexus.dockerregistry.daily}/${datarouter.node.image.name}:latest</imageName>

-							<skipDockerPush>${skip.docker.push}</skipDockerPush>

-						</configuration>

-					</execution>

-				</executions>

-			</plugin>

-			<plugin>

 				<groupId>org.apache.maven.plugins</groupId>

 				<artifactId>maven-dependency-plugin</artifactId>

 				<version>2.10</version>

@@ -546,26 +497,4 @@
 			</plugin>

 		</plugins>

 	</build>

-	<distributionManagement>

-		<repository>

-			<id>ecomp-releases</id>

-			<name>DR Release Repository</name>

-			<url>${onap.nexus.url}${releaseNexusPath}</url>

-		</repository>

-		<snapshotRepository>

-			<id>ecomp-snapshots</id>

-			<name>DR Snapshot Repository</name>

-			<url>${onap.nexus.url}${snapshotNexusPath}</url>

-		</snapshotRepository>

-		<site>

-			<id>ecomp-site</id>

-			<url>dav:${onap.nexus.url}${sitePath}</url>

-		</site>

-	</distributionManagement>

-	<pluginRepositories>

-		<pluginRepository>

-			<id>onap-plugin-snapshots</id>

-			<url>${onap.nexus.url}${snapshotNexusPath}</url>

-		</pluginRepository>

-	</pluginRepositories>

 </project>

diff --git a/datarouter-prov/pom.xml b/datarouter-prov/pom.xml
index a348c78..2107e9c 100755
--- a/datarouter-prov/pom.xml
+++ b/datarouter-prov/pom.xml
@@ -7,9 +7,9 @@
   * Licensed under the Apache License, Version 2.0 (the "License");

   * you may not use this file except in compliance with the License.

   * You may obtain a copy of the License at

-  * 

+  *

    *      http://www.apache.org/licenses/LICENSE-2.0

-  * 

+  *

    * Unless required by applicable law or agreed to in writing, software

   * distributed under the License is distributed on an "AS IS" BASIS,

   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

@@ -218,18 +218,52 @@
             <scope>compile</scope>

         </dependency>

     </dependencies>

-

     <profiles>

         <profile>

             <id>docker</id>

             <properties>

-                <skip.docker.build>false</skip.docker.build>

-                <skip.docker.tag>false</skip.docker.tag>

-                <skip.docker.push>false</skip.docker.push>

+                <skipDockerBuild>false</skipDockerBuild>

+                <skipDockerTag>false</skipDockerTag>

+                <skipTests>true</skipTests>

             </properties>

+            <build>

+                <plugins>

+                    <plugin>

+                        <groupId>com.spotify</groupId>

+                        <artifactId>docker-maven-plugin</artifactId>

+                        <version>1.0.0</version>

+                        <configuration>

+                            <imageName>${onap.nexus.dockerregistry.daily}/${datarouter.prov.image.name}</imageName>

+                            <dockerDirectory>${docker.location}</dockerDirectory>

+                            <serverId>${onap.nexus.dockerregistry.daily}</serverId>

+                            <skipDockerBuild>false</skipDockerBuild>

+                            <imageTags>

+                                <imageTag>${project.version}</imageTag>

+                                <imageTag>latest</imageTag>

+                            </imageTags>

+                            <forceTags>true</forceTags>

+                            <resources>

+                                <resource>

+                                    <targetPath>/</targetPath>

+                                    <directory>${project.basedir}</directory>

+                                    <excludes>

+                                        <exclude>target/**/*</exclude>

+                                        <exclude>pom.xml</exclude>

+                                    </excludes>

+                                </resource>

+

+                                <resource>

+                                    <targetPath>/</targetPath>

+                                    <directory>${project.build.directory}</directory>

+                                    <include>**/**</include>

+                                </resource>

+                            </resources>

+                        </configuration>

+                    </plugin>

+                </plugins>

+            </build>

         </profile>

     </profiles>

-

     <build>

         <finalName>datarouter-prov</finalName>

         <resources>

@@ -301,92 +335,6 @@
                 <version>3.6.0</version>

             </plugin>

             <plugin>

-                <groupId>com.spotify</groupId>

-                <artifactId>docker-maven-plugin</artifactId>

-                <version>${docker.maven.plugin.version}</version>

-                <configuration>

-                    <skipDockerBuild>false</skipDockerBuild>

-                    <imageName>${datarouter.prov.image.name}</imageName>

-                    <dockerDirectory>${docker.location}</dockerDirectory>

-                    <serverId>docker-hub</serverId>

-                    <imageTags>

-                        <imageTag>${project.version}</imageTag>

-                        <imageTag>latest</imageTag>

-                    </imageTags>

-                    <forceTags>true</forceTags>

-                    <resources>

-                        <resource>

-                            <targetPath>/</targetPath>

-                            <directory>${docker.location}</directory>

-                            <include>${project.build.finalName}.jar</include>

-                        </resource>

-                        <resource>

-                            <targetPath>/</targetPath>

-                            <directory>${project.build.directory}</directory>

-                            <include>**/**</include>

-                        </resource>

-                    </resources>

-                </configuration>

-                <executions>

-                    <execution>

-                        <id>build-image</id>

-                        <phase>install</phase>

-                        <goals>

-                            <goal>build</goal>

-                        </goals>

-                        <configuration>

-                            <skipDockerBuild>${skip.docker.build}</skipDockerBuild>

-                        </configuration>

-                    </execution>

-                    <execution>

-                        <id>tag-image-project-version</id>

-                        <phase>install</phase>

-                        <goals>

-                            <goal>tag</goal>

-                        </goals>

-                        <configuration>

-                            <image>${datarouter.prov.image.name}</image>

-                            <newName>${onap.nexus.dockerregistry.daily}/${datarouter.prov.image.name}:${project.version}</newName>

-                            <skipDockerTag>${skip.docker.push}</skipDockerTag>

-                        </configuration>

-                    </execution>

-                    <execution>

-                        <id>tag-image-latest</id>

-                        <phase>install</phase>

-                        <goals>

-                            <goal>tag</goal>

-                        </goals>

-                        <configuration>

-                            <image>${datarouter.prov.image.name}</image>

-                            <newName>${onap.nexus.dockerregistry.daily}/${datarouter.prov.image.name}:latest</newName>

-                            <skipDockerTag>${skip.docker.push}</skipDockerTag>

-                        </configuration>

-                    </execution>

-                    <execution>

-                        <id>push-image-latest</id>

-                        <phase>deploy</phase>

-                        <goals>

-                            <goal>push</goal>

-                        </goals>

-                        <configuration>

-                            <imageName>${onap.nexus.dockerregistry.daily}/${datarouter.prov.image.name}:${project.version}</imageName>

-                            <skipDockerPush>${skip.docker.push}</skipDockerPush>

-                        </configuration>

-                    </execution>

-                    <execution>

-                        <id>push-image</id>

-                        <phase>deploy</phase>

-                        <goals>

-                            <goal>push</goal>

-                        </goals>

-                        <configuration>

-                            <imageName>${onap.nexus.dockerregistry.daily}/${datarouter.prov.image.name}:latest</imageName>

-                            <skipDockerPush>${skip.docker.push}</skipDockerPush>

-                        </configuration>

-                    </execution>

-                </executions>

-            </plugin>

-            <plugin>

                 <artifactId>maven-resources-plugin</artifactId>

                 <version>2.7</version>

                 <executions>

@@ -618,26 +566,4 @@
             </plugin>

         </plugins>

     </build>

-    <distributionManagement>

-        <repository>

-            <id>ecomp-releases</id>

-            <name>DR Release Repository</name>

-            <url>${onap.nexus.url}${releaseNexusPath}</url>

-        </repository>

-        <snapshotRepository>

-            <id>ecomp-snapshots</id>

-            <name>DR Snapshot Repository</name>

-            <url>${onap.nexus.url}${snapshotNexusPath}</url>

-        </snapshotRepository>

-        <site>

-            <id>ecomp-site</id>

-            <url>dav:${onap.nexus.url}${sitePath}</url>

-        </site>

-    </distributionManagement>

-    <pluginRepositories>

-        <pluginRepository>

-            <id>onap-plugin-snapshots</id>

-            <url>${onap.nexus.url}${snapshotNexusPath}</url>

-        </pluginRepository>

-    </pluginRepositories>

 </project>