[SDNC-7] Update SDNC Image - Use dependency plugin

This patch removes OpenDaylight tar.gz and
mysql-connector tar.gz and uses maven-dependency-plugin
to get these files instead.

Change-Id: I1c0885fe5beec3b9d151bc2f60fe2f669a620413
Signed-off-by: Marcus G K Williams <marcus.williams@intel.com>

Former-commit-id: 55d1ae5a085835731c6305cfaacec10a2b0314d8
diff --git a/installation/sdnc/pom.xml b/installation/sdnc/pom.xml
index 808d8b9..b227306 100644
--- a/installation/sdnc/pom.xml
+++ b/installation/sdnc/pom.xml
@@ -24,8 +24,27 @@
 		<sdnc.adaptors.version>${project.version}</sdnc.adaptors.version>
 		<sdnc.northbound.version>${project.version}</sdnc.northbound.version>
 		<sdnc.plugins.version>${project.version}</sdnc.plugins.version>
+		<sdnc.opendaylight.version>0.5.1-Boron-SR1</sdnc.opendaylight.version>
+		<sdnc.mysql-connector-java.version>5.1.39</sdnc.mysql-connector-java.version>
+		<docker.buildArg.https_proxy>${https_proxy}</docker.buildArg.https_proxy>
 	</properties>
 
+	<dependencyManagement>
+		<dependencies>
+			<dependency>
+				<groupId>org.opendaylight.integration</groupId>
+				<artifactId>distribution-karaf</artifactId>
+				<version>${sdnc.opendaylight.version}</version>
+				<type>tar.gz</type>
+			</dependency>
+			<dependency>
+				<groupId>mysql</groupId>
+				<artifactId>mysql-connector-java</artifactId>
+				<version>${sdnc.mysql-connector-java.version}</version>
+				<type>jar</type>
+			</dependency>
+		</dependencies>
+	</dependencyManagement>
 
 	<build>
 		<plugins>
@@ -62,13 +81,13 @@
 					</execution>
 				</executions>
 			</plugin>
+
 			<plugin>
 				<groupId>io.fabric8</groupId>
 				<artifactId>docker-maven-plugin</artifactId>
 				<version>0.16.5</version>
 				<inherited>false</inherited>
 				<configuration>
-
 					<images>
 						<image>
 							<name>${image.name}</name>
@@ -107,12 +126,43 @@
 
 
 			<plugin>
+			<groupId>org.apache.maven.plugins</groupId>
+			<artifactId>maven-dependency-plugin</artifactId>
+			<version>3.0.0</version>
+			<executions>
+				<execution>
+					<id>get-odl-distribution</id>
+					<phase>validate</phase>
+					<goals>
+						<goal>copy</goal>
+					</goals>
+					<configuration>
+						<artifactItems>
+							<artifactItem>
+								<groupId>org.opendaylight.integration</groupId>
+								<artifactId>distribution-karaf</artifactId>
+								<version>${sdnc.opendaylight.version}</version>
+								<type>tar.gz</type>
+
+								<overWrite>true</overWrite>
+								<outputDirectory>${basedir}/target/docker-stage</outputDirectory>
+							</artifactItem>
+						</artifactItems>
+						<overWriteReleases>false</overWriteReleases>
+						<overWriteSnapshots>true</overWriteSnapshots>
+						<overWriteIfNewer>true</overWriteIfNewer>
+					</configuration>
+				</execution>
+			</executions>
+			</plugin>
+
+			<plugin>
 				<groupId>org.apache.maven.plugins</groupId>
 				<artifactId>maven-dependency-plugin</artifactId>
 				<version>3.0.0</version>
 				<executions>
 					<execution>
-						<id>get-odl-distribution</id>
+						<id>get-mysql-connector-jar</id>
 						<phase>validate</phase>
 						<goals>
 							<goal>copy</goal>
@@ -120,10 +170,10 @@
 						<configuration>
 							<artifactItems>
 								<artifactItem>
-									<groupId>org.opendaylight.integration</groupId>
-									<artifactId>distribution-karaf</artifactId>
-									<version>0.5.1-Boron-SR1</version>
-									<type>tar.gz</type>
+									<groupId>mysql</groupId>
+									<artifactId>mysql-connector-java</artifactId>
+									<version>${sdnc.mysql-connector-java.version}</version>
+									<type>jar</type>
 
 									<overWrite>true</overWrite>
 									<outputDirectory>${basedir}/target/docker-stage</outputDirectory>
@@ -193,7 +243,6 @@
 								<resource>
 									<directory>src/main/resources</directory>
 									<includes>
-										<include>*.tgz</include>
 										<include>idmlight.db.mv.db</include>
 									</includes>
 									<filtering>false</filtering>
diff --git a/installation/sdnc/src/main/docker/Dockerfile b/installation/sdnc/src/main/docker/Dockerfile
index 14b7710..55f74b7 100644
--- a/installation/sdnc/src/main/docker/Dockerfile
+++ b/installation/sdnc/src/main/docker/Dockerfile
@@ -6,10 +6,13 @@
 ENV SDNC_CONFIG_DIR /opt/openecomp/sdnc/data/properties
 
 # copy the opendaylight tar and expand
-COPY distribution-karaf-0.5.1-Boron-SR1.tar.gz /tmp
-RUN mkdir /opt/opendaylight /opt/openecomp
-RUN tar zxvf /tmp/distribution-karaf-0.5.1-Boron-SR1.tar.gz --directory /opt/opendaylight
-RUN ln -s /opt/opendaylight/distribution-karaf-0.5.1-Boron-SR1 /opt/opendaylight/current
+COPY distribution-karaf-${sdnc.opendaylight.version}.tar.gz /tmp/
+RUN mkdir /opt/opendaylight \
+&& tar zxvf /tmp/distribution-karaf-${sdnc.opendaylight.version}.tar.gz --directory /opt/opendaylight \
+&& rm -rf /tmp/distribution-karaf-${sdnc.opendaylight.version}.tar.gz \
+&& ln -s /opt/opendaylight/distribution-karaf-${sdnc.opendaylight.version} /opt/opendaylight/current \
+&& mkdir /opt/openecomp
+
 COPY idmlight.db.mv.db /opt/opendaylight/current
 
 # copy openecomp
@@ -17,7 +20,6 @@
 RUN ln -s /opt/openecomp/sdnc /opt/sdnc
 
 # workaround till we get proxy working
-COPY mysql.tgz /tmp
-RUN tar zxvf /tmp/mysql.tgz --directory /opt/opendaylight/current/system
+COPY mysql-connector-java-${sdnc.mysql-connector-java.version}.jar /opt/opendaylight/current/system
 # ENTRYPOINT exec /opt/opendaylight/current/bin/karaf
 EXPOSE 8181
diff --git a/installation/sdnc/src/main/resources/mysql.tgz b/installation/sdnc/src/main/resources/mysql.tgz
deleted file mode 100644
index 65973df..0000000
--- a/installation/sdnc/src/main/resources/mysql.tgz
+++ /dev/null
Binary files differ