site.incse, site.mncse: build docker image from maven.

Docker images are built whether 'docker' maven profile is enabled.

Signed-off-by: BOLLE Sebastien <sebastien.bolle@orange.com>
Signed-off-by: BONNARDEL Gregory <gbonnardel.ext@orange.com>
diff --git a/org.eclipse.om2m.site.in-cse/README.md b/org.eclipse.om2m.site.in-cse/README.md
index 65e1bc3..d009e92 100644
--- a/org.eclipse.om2m.site.in-cse/README.md
+++ b/org.eclipse.om2m.site.in-cse/README.md
@@ -24,3 +24,9 @@
 -------------
 docker run --rm -it -p 8080:8080 org.eclipse.om2m.site.incse 
 Optionnally, you can mount volumes /incse/configurations & /incse/configuration
+
+
+Build with maven
+----------------
+Docker image can be built with maven. Enable "docker" profile:
+mvn clean install -Pdocker
\ No newline at end of file
diff --git a/org.eclipse.om2m.site.in-cse/pom.xml b/org.eclipse.om2m.site.in-cse/pom.xml
index 7a1e1f2..04a28ec 100644
--- a/org.eclipse.om2m.site.in-cse/pom.xml
+++ b/org.eclipse.om2m.site.in-cse/pom.xml
@@ -17,8 +17,12 @@
         François Aïssaoui : Developer

    

     New contributors :

+        Sebastien BOLLE <sebastien.bolle@orange.com>

+        Gregory BONNARDEL <gbonnardel.ext@orange.com>

+        Cyrille BAREAU <cyrille.bareau@orange.com>

  -->

-<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/maven-v4_0_0.xsd">

+<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/maven-v4_0_0.xsd">

 	<modelVersion>4.0.0</modelVersion>

 	<parent>

 		<artifactId>org.eclipse.om2m</artifactId>

@@ -29,42 +33,78 @@
 	<packaging>eclipse-repository</packaging>

 	<name>org.eclipse.om2m :: in product</name>

 	<build>

- 		<plugins>

-  			<plugin>

-   				<groupId>org.eclipse.tycho</groupId>

-   				<artifactId>tycho-p2-director-plugin</artifactId>

-   				<version>${tycho.version}</version>

-   				<executions>

-    				<execution>

-     					<id>materialize-products</id>

-     					<goals>

-      						<goal>materialize-products</goal>

-     					</goals>

-    				</execution>

-   				</executions>

-  			</plugin>

+		<plugins>

+			<plugin>

+				<groupId>org.eclipse.tycho</groupId>

+				<artifactId>tycho-p2-director-plugin</artifactId>

+				<version>${tycho.version}</version>

+				<executions>

+					<execution>

+						<id>materialize-products</id>

+						<phase>package</phase>

+						<goals>

+							<goal>materialize-products</goal>

+						</goals>

+					</execution>

+				</executions>

+			</plugin>

 			<plugin>

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

 				<artifactId>maven-antrun-plugin</artifactId>

 				<version>1.1</version>

 				<executions>

 					<execution>

-						<phase>install</phase>

+						<phase>package</phase>

 						<goals>

 							<goal>run</goal>

 						</goals>

 						<configuration>

 							<tasks>

 								<echo>Copying scripts into in product</echo>

-								<copy file="${basedir}/script" tofile="${basedir}/target/products/in-cse/${osgi.os}/${osgi.ws}/${osgi.arch}/start.sh"/>

-								<copy file="${basedir}/script" tofile="${basedir}/target/products/in-cse/${osgi.os}/${osgi.ws}/${osgi.arch}/start.bat"/>

-								<copy file="${basedir}/log4j.configuration" tofile="${basedir}/target/products/in-cse/${osgi.os}/${osgi.ws}/${osgi.arch}/log4j.configuration"/>

+								<copy file="${basedir}/script"

+									tofile="${basedir}/target/products/in-cse/${osgi.os}/${osgi.ws}/${osgi.arch}/start.sh" />

+								<copy file="${basedir}/script"

+									tofile="${basedir}/target/products/in-cse/${osgi.os}/${osgi.ws}/${osgi.arch}/start.bat" />

+								<copy file="${basedir}/log4j.configuration"

+									tofile="${basedir}/target/products/in-cse/${osgi.os}/${osgi.ws}/${osgi.arch}/log4j.configuration" />

 							</tasks>

 						</configuration>

 					</execution>

 				</executions>

 			</plugin>

- 		</plugins>

- 	</build>

- 

+		</plugins>

+	</build>

+

+	<profiles>

+		<profile>

+			<id>docker</id>

+			<build>

+				<plugins>

+					<plugin>

+						<groupId>com.spotify</groupId>

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

+						<version>1.0.0</version>

+						<executions>

+							<execution>

+								<phase>package</phase>

+								<goals>

+									<goal>build</goal>

+								</goals>

+							</execution>

+						</executions>

+						<configuration>

+							<imageName>org.eclipse.om2m.site.incse</imageName>

+							<dockerDirectory>.</dockerDirectory>

+							<resources>

+								<resource>

+									<targetPath>/</targetPath>

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

+								</resource>

+							</resources>

+						</configuration>

+					</plugin>

+				</plugins>

+			</build>

+		</profile>

+	</profiles>

 </project>

diff --git a/org.eclipse.om2m.site.mn-cse/README.md b/org.eclipse.om2m.site.mn-cse/README.md
index c040fb0..519a846 100644
--- a/org.eclipse.om2m.site.mn-cse/README.md
+++ b/org.eclipse.om2m.site.mn-cse/README.md
@@ -15,12 +15,16 @@
 
 Build image
 -----------
-
 docker build -t org.eclipse.om2m.site.mncse .
 
 
-
 Run container
 -------------
 docker run --rm -it -p 8282:8282 org.eclipse.om2m.site.mncse 
 Optionnally, you can mount volumes /mncse/configurations & /mncse/configuration
+
+
+Build with maven
+----------------
+Docker image can be built with maven. Enable "docker" profile:
+mvn clean install -Pdocker
\ No newline at end of file
diff --git a/org.eclipse.om2m.site.mn-cse/pom.xml b/org.eclipse.om2m.site.mn-cse/pom.xml
index 6817a67..bc6e4e0 100644
--- a/org.eclipse.om2m.site.mn-cse/pom.xml
+++ b/org.eclipse.om2m.site.mn-cse/pom.xml
@@ -16,6 +16,9 @@
         Fran?ois A?ssaoui : Developer
    
     New contributors :
+        Sebastien BOLLE <sebastien.bolle@orange.com>
+        Gregory BONNARDEL <gbonnardel.ext@orange.com>
+        Cyrille BAREAU <cyrille.bareau@orange.com>
  -->
 <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">
@@ -38,6 +41,7 @@
 				<executions>
 					<execution>
 						<id>materialize-products</id>
+						<phase>package</phase>
 						<goals>
 							<goal>materialize-products</goal>
 						</goals>
@@ -47,35 +51,75 @@
 			<plugin>
 				<groupId>org.apache.maven.plugins</groupId>
 				<artifactId>maven-antrun-plugin</artifactId>
-				<version>1.7</version>
+				<version>1.8</version>
 				<executions>
 					<execution>
-						<phase>install</phase>
+						<phase>package</phase>
 						<goals>
 							<goal>run</goal>
 						</goals>
 						<configuration>
-							<tasks>
+							<target>
 								<echo>Copying scripts into mn product</echo>
-								<copy file="${basedir}/script" tofile="${basedir}/target/products/mn-cse/${osgi.os}/${osgi.ws}/${osgi.arch}/start.sh" />
-								<copy file="${basedir}/script" tofile="${basedir}/target/products/mn-cse/${osgi.os}/${osgi.ws}/${osgi.arch}/start.bat" />
-								<copy file="${basedir}/log4j.configuration" tofile="${basedir}/target/products/mn-cse/${osgi.os}/${osgi.ws}/${osgi.arch}/log4j.configuration"/>
-								<!-- <copy file="${basedir}/org.eclipse.equinox.cm_1.0.400.v20130327-1442.jar" todir="${basedir}/target/products/mn-cse/${osgi.os}/${osgi.ws}/${osgi.arch}/plugins/" /> -->
-								<copy file="${basedir}/pax-confman-propsloader-0.2.2.jar" todir="${basedir}/target/products/mn-cse/${osgi.os}/${osgi.ws}/${osgi.arch}/plugins/" />
-								<copy todir="${basedir}/target/products/mn-cse/${osgi.os}/${osgi.ws}/${osgi.arch}/configurations">
+								<copy file="${basedir}/script"
+									tofile="${basedir}/target/products/mn-cse/${osgi.os}/${osgi.ws}/${osgi.arch}/start.sh" />
+								<copy file="${basedir}/script"
+									tofile="${basedir}/target/products/mn-cse/${osgi.os}/${osgi.ws}/${osgi.arch}/start.bat" />
+								<copy file="${basedir}/log4j.configuration"
+									tofile="${basedir}/target/products/mn-cse/${osgi.os}/${osgi.ws}/${osgi.arch}/log4j.configuration" />
+								<!-- <copy file="${basedir}/org.eclipse.equinox.cm_1.0.400.v20130327-1442.jar" 
+									todir="${basedir}/target/products/mn-cse/${osgi.os}/${osgi.ws}/${osgi.arch}/plugins/" 
+									/> -->
+								<copy file="${basedir}/pax-confman-propsloader-0.2.2.jar"
+									todir="${basedir}/target/products/mn-cse/${osgi.os}/${osgi.ws}/${osgi.arch}/plugins/" />
+								<copy
+									todir="${basedir}/target/products/mn-cse/${osgi.os}/${osgi.ws}/${osgi.arch}/configurations">
 									<fileset dir="${basedir}/configurations" includes="**/*" />
 								</copy>
-								
-								
-								<propertyfile file="${basedir}/target/products/mn-cse/${osgi.os}/${osgi.ws}/${osgi.arch}/configuration/config.ini">
-									<entry key="osgi.bundles" type="string" operation="+" value=", reference:file:pax-confman-propsloader-0.2.2.jar@1:start" />
+
+
+								<propertyfile
+									file="${basedir}/target/products/mn-cse/${osgi.os}/${osgi.ws}/${osgi.arch}/configuration/config.ini">
+									<entry key="osgi.bundles" type="string" operation="+"
+										value=", reference:file:pax-confman-propsloader-0.2.2.jar@1:start" />
 								</propertyfile>
-							</tasks>
+							</target>
 						</configuration>
 					</execution>
 				</executions>
 			</plugin>
 		</plugins>
 	</build>
-
-</project>
\ No newline at end of file
+	<profiles>
+		<profile>
+			<id>docker</id>
+			<build>
+				<plugins>
+					<plugin>
+						<groupId>com.spotify</groupId>
+						<artifactId>docker-maven-plugin</artifactId>
+						<version>1.0.0</version>
+						<executions>
+							<execution>
+								<phase>package</phase>
+								<goals>
+									<goal>build</goal>
+								</goals>
+							</execution>
+						</executions>
+						<configuration>
+							<imageName>org.eclipse.om2m.site.mncse</imageName>
+							<dockerDirectory>.</dockerDirectory>
+							<resources>
+								<resource>
+									<targetPath>/</targetPath>
+									<directory>${project.build.directory}</directory>
+								</resource>
+							</resources>
+						</configuration>
+					</plugin>
+				</plugins>
+			</build>
+		</profile>
+	</profiles>
+</project>