This is an automated email from the ASF dual-hosted git repository.

shuber pushed a commit to branch unomi-3-dev
in repository https://gitbox.apache.org/repos/asf/unomi.git


The following commit(s) were added to refs/heads/unomi-3-dev by this push:
     new f0f3ec340 UNOMI-921 Replace `elasticsearch-maven-plugin` with 
`docker-maven-plugin` for better containerized Elasticsearch management and 
update integration test Docker checks.
f0f3ec340 is described below

commit f0f3ec3407985419bb86c7130f0fcd45dbeb3533
Author: Serge Huber <[email protected]>
AuthorDate: Thu Jan 1 16:17:36 2026 +0100

    UNOMI-921 Replace `elasticsearch-maven-plugin` with `docker-maven-plugin` 
for better containerized Elasticsearch management and update integration test 
Docker checks.
---
 build.sh       | 59 +++++++++++++++++++++++++++++++++++++++++
 itests/pom.xml | 83 ++++++++++++++++++++++++++++++++++++++--------------------
 pom.xml        |  6 -----
 3 files changed, 113 insertions(+), 35 deletions(-)

diff --git a/build.sh b/build.sh
index 95ee78d51..42c3d432e 100755
--- a/build.sh
+++ b/build.sh
@@ -694,6 +694,65 @@ check_requirements() {
         has_errors=true
     fi
 
+    # Docker check for integration tests
+    if [ "$RUN_INTEGRATION_TESTS" = true ]; then
+        print_status "info" "Checking Docker availability for integration 
tests..."
+        if ! command_exists docker; then
+            print_status "error" "Docker is not installed or not in PATH"
+            echo "Integration tests require Docker to run 
Elasticsearch/OpenSearch containers."
+            echo "Please install Docker:"
+            if [[ "$(uname)" == "Darwin" ]]; then
+                echo "  - macOS: Download Docker Desktop from 
https://www.docker.com/products/docker-desktop";
+                echo "  - Or install via Homebrew: brew install --cask docker"
+            else
+                echo "  - Ubuntu/Debian: sudo apt install docker.io"
+                echo "  - CentOS/RHEL/Fedora: sudo yum install docker (or sudo 
dnf install docker)"
+                echo "  - Or follow: https://docs.docker.com/get-docker/";
+            fi
+            has_errors=true
+        else
+            # Check if Docker daemon is running and accessible
+            docker_info_output=$(docker info 2>&1)
+            docker_info_exit_code=$?
+            if [ $docker_info_exit_code -ne 0 ]; then
+                # Check if it's a permission issue vs daemon not running
+                if echo "$docker_info_output" | grep -q "permission 
denied\|Got permission denied"; then
+                    print_status "error" "Docker permission denied"
+                    echo "Docker is installed but you don't have permission to 
access it."
+                    if [[ "$(uname)" == "Darwin" ]]; then
+                        echo "On macOS, ensure Docker Desktop is running and 
you're logged in."
+                    else
+                        echo "On Linux, add your user to the docker group:"
+                        echo "  sudo usermod -aG docker $USER"
+                        echo "  Then log out and log back in, or run: newgrp 
docker"
+                        echo "Alternatively, you can use sudo (not recommended 
for security reasons)."
+                    fi
+                elif echo "$docker_info_output" | grep -q "Cannot connect to 
the Docker daemon\|Is the docker daemon running"; then
+                    print_status "error" "Docker daemon is not running"
+                    echo "Please start Docker daemon:"
+                    if [[ "$(uname)" == "Darwin" ]]; then
+                        echo "  - macOS: Start Docker Desktop application from 
Applications"
+                        echo "  - Or from command line: open -a Docker"
+                    else
+                        echo "  - Linux: sudo systemctl start docker"
+                        echo "  - Or for older systems: sudo service docker 
start"
+                        echo "  - To enable auto-start: sudo systemctl enable 
docker"
+                    fi
+                    echo "  - Verify status: docker info"
+                else
+                    print_status "error" "Docker is not accessible"
+                    echo "Docker command failed with:"
+                    echo "$docker_info_output"
+                    echo "Please check Docker installation and daemon status."
+                fi
+                has_errors=true
+            else
+                docker_version=$(docker --version 2>&1)
+                print_status "success" "✓ Docker available: ${docker_version}"
+            fi
+        fi
+    fi
+
     # OpenSearch password check
     if [ "$USE_OPENSEARCH" = true ] || [ "$AUTO_START" = "opensearch" ]; then
         if [ -z "$UNOMI_OPENSEARCH_PASSWORD" ]; then
diff --git a/itests/pom.xml b/itests/pom.xml
index e6520d02c..025c848af 100644
--- a/itests/pom.xml
+++ b/itests/pom.xml
@@ -254,6 +254,9 @@
     <profiles>
         <profile>
             <id>elasticsearch</id>
+            <properties>
+                <elasticsearch.port>9400</elasticsearch.port>
+            </properties>
             <activation>
                 <activeByDefault>true</activeByDefault>
                 <property>
@@ -273,6 +276,7 @@
                             <systemPropertyVariables>
                                 <my.system.property>foo</my.system.property>
                                 
<unomi.search.engine>elasticsearch</unomi.search.engine>
+                                
<elasticsearch.port>${elasticsearch.port}</elasticsearch.port>
                             </systemPropertyVariables>
                         </configuration>
                         <executions>
@@ -291,43 +295,64 @@
                         </executions>
                     </plugin>
                     <plugin>
-                        <groupId>com.github.alexcojocaru</groupId>
-                        <artifactId>elasticsearch-maven-plugin</artifactId>
-                        <!-- REPLACE THE FOLLOWING WITH THE PLUGIN VERSION YOU 
NEED -->
-                        <version>6.29</version>
+                        <groupId>io.fabric8</groupId>
+                        <artifactId>docker-maven-plugin</artifactId>
                         <configuration>
-                            <!-- 
<downloadUrl>https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-9.1.3-darwin-aarch64.tar
-                            .gz</downloadUrl> -->
-                            
<clusterName>contextElasticSearchITests</clusterName>
-                            <transportPort>9500</transportPort>
-                            <httpPort>9400</httpPort>
-                            <version>${elasticsearch.test.version}</version>
-                            <autoCreateIndex>true</autoCreateIndex>
-                            
<instanceStartupTimeout>120</instanceStartupTimeout>
-                            <environmentVariables>
-                                <ES_JAVA_OPTS>-Xms4g -Xmx4g</ES_JAVA_OPTS>
-                            </environmentVariables>
-                            <instanceSettings>
-                                <properties>
-                                    <xpack.ml.enabled>false</xpack.ml.enabled>
-                                    
<path.repo>${project.build.directory}/snapshots_repository</path.repo>
-                                    
<cluster.routing.allocation.disk.threshold_enabled>false</cluster.routing.allocation.disk.threshold_enabled>
-                                    
<http.cors.allow-methods>OPTIONS,HEAD,GET,POST,PUT,DELETE</http.cors.allow-methods>
-                                    
<http.cors.allow-headers>Authorization,X-Requested-With,X-Auth-Token,Content-Type,Content-Length</http.cors.allow-headers>
-                                </properties>
-                            </instanceSettings>
+                            
<containerNamePattern>itests-elasticsearch</containerNamePattern>
+                            <images>
+                                <image>
+                                    
<name>docker.elastic.co/elasticsearch/elasticsearch:${elasticsearch.test.version}</name>
+                                    <alias>elasticsearch</alias>
+                                    <run>
+                                        <ports>
+                                            
<port>${elasticsearch.port}:9200</port>
+                                        </ports>
+                                        <env>
+                                            
<discovery.type>single-node</discovery.type>
+                                            <ES_JAVA_OPTS>-Xms8g -Xmx8g 
-Dcluster.default.index.settings.number_of_replicas=0</ES_JAVA_OPTS>
+                                            
<xpack.security.enabled>false</xpack.security.enabled>
+                                            
<xpack.ml.enabled>false</xpack.ml.enabled>
+                                            
<path.repo>/tmp/snapshots_repository</path.repo>
+                                            
<cluster.routing.allocation.disk.threshold_enabled>false</cluster.routing.allocation.disk.threshold_enabled>
+                                        </env>
+                                        <volumes>
+                                            <bind>
+                                                
<volume>${project.build.directory}/snapshots_repository:/tmp/snapshots_repository</volume>
+                                            </bind>
+                                        </volumes>
+                                        <wait>
+                                            <http>
+                                                
<url>http://localhost:${elasticsearch.port}</url>
+                                                <method>GET</method>
+                                                <status>200</status>
+                                            </http>
+                                            <time>120000</time>
+                                        </wait>
+                                        
<portPropertyFile>${project.build.directory}/elasticsearch-port.properties</portPropertyFile>
+                                    </run>
+                                </image>
+                            </images>
                         </configuration>
                         <executions>
-                            <!--
-                                The elasticsearch maven plugin goals are by 
default bound to the
-                                pre-integration-test and post-integration-test 
phases
-                            -->
+                            <!-- Force remove existing container before 
starting -->
+                            <execution>
+                                <id>remove-existing-container</id>
+                                <phase>pre-integration-test</phase>
+                                <goals>
+                                    <goal>stop</goal> <!-- Stops the container 
if running -->
+                                    <goal>remove</goal> <!-- Removes the 
container -->
+                                </goals>
+                            </execution>
+
                             <execution>
                                 <id>start-elasticsearch</id>
                                 <phase>pre-integration-test</phase>
                                 <goals>
-                                    <goal>runforked</goal>
+                                    <goal>start</goal>
                                 </goals>
+                                <configuration>
+                                    <showLogs>true</showLogs>
+                                </configuration>
                             </execution>
                             <execution>
                                 <id>stop-elasticsearch</id>
diff --git a/pom.xml b/pom.xml
index 8be830a89..1524d42c8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -157,7 +157,6 @@
         <exec-maven-plugin.version>3.1.0</exec-maven-plugin.version>
         
<maven-remote-resources-plugin.version>3.0.0</maven-remote-resources-plugin.version>
         <docker-maven-plugin.version>0.46.0</docker-maven-plugin.version>
-        
<elasticsearch-maven-plugin.version>6.29</elasticsearch-maven-plugin.version>
         <jacoco-maven-plugin.version>0.8.13</jacoco-maven-plugin.version>
         <maven-clean-plugin.version>3.1.0</maven-clean-plugin.version>
         <frontend-maven-plugin.version>1.12.1</frontend-maven-plugin.version>
@@ -942,11 +941,6 @@
                     <artifactId>docker-maven-plugin</artifactId>
                     <version>${docker-maven-plugin.version}</version>
                 </plugin>
-                <plugin>
-                    <groupId>com.github.alexcojocaru</groupId>
-                    <artifactId>elasticsearch-maven-plugin</artifactId>
-                    <version>${elasticsearch-maven-plugin.version}</version>
-                </plugin>
                 <plugin>
                     <groupId>org.jacoco</groupId>
                     <artifactId>jacoco-maven-plugin</artifactId>

Reply via email to