From f2e0b893c14a8ff95e5f5c1f5953a9e5690d3e1c Mon Sep 17 00:00:00 2001
From: Sonia Zorba <sonia.zorba@inaf.it>
Date: Sun, 10 Jan 2021 12:27:10 +0100
Subject: [PATCH] Added Maven profiles for loading io.zonky.test.postgres
 dependency dinamically according to detected OS

---
 pom.xml | 47 +++++++++++++++++++++++++++++++++++------------
 1 file changed, 35 insertions(+), 12 deletions(-)

diff --git a/pom.xml b/pom.xml
index 0d093aa..f16c5d5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -19,6 +19,7 @@
         <!-- File catalog repository directory -->
         <init_database_scripts_path>../../../vospace-file-catalog</init_database_scripts_path>
         <finalName>${project.artifactId}-${project.version}</finalName>
+        <zonky.postgres-binaries.version>12.5.0</zonky.postgres-binaries.version>
     </properties>
 
     <dependencies>
@@ -96,21 +97,43 @@
             <version>0.13.3</version>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>io.zonky.test.postgres</groupId>
-            <artifactId>embedded-postgres-binaries-linux-amd64</artifactId>
-            <version>12.5.0</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>io.zonky.test.postgres</groupId>
-            <artifactId>embedded-postgres-binaries-windows-amd64</artifactId>
-            <version>12.5.0</version>
-            <scope>test</scope>
-        </dependency>
 
     </dependencies>
     
+    <profiles>
+        <profile>
+            <id>platform-linux</id>
+            <activation>
+                <os>
+                    <family>unix</family> 
+                </os>
+            </activation>
+            <dependencies>
+                <dependency>
+                    <groupId>io.zonky.test.postgres</groupId>
+                    <artifactId>embedded-postgres-binaries-linux-amd64</artifactId>
+                    <version>${zonky.postgres-binaries.version}</version>
+                    <scope>test</scope>
+                </dependency>
+            </dependencies>
+        </profile>
+        <profile>
+            <id>platform-windows</id>
+            <activation>
+                <os>
+                    <family>windows</family>
+                </os>
+            </activation>
+            <dependencies>
+                <dependency>
+                    <groupId>io.zonky.test.postgres</groupId>
+                    <artifactId>embedded-postgres-binaries-windows-amd64</artifactId>
+                    <version>${zonky.postgres-binaries.version}</version>
+                    <scope>test</scope>
+                </dependency>
+            </dependencies>
+        </profile>
+    </profiles>
     
     <repositories>
         <repository>
-- 
GitLab