I'am trying to execute integration test, ie at integration-test maven phase with maven-failsafe plugin, with vertx. I'am near my objective, but vertx configuration is not read. I don't know why.
Before actually running IT (integration tests), I need to start all my vertices (or micro services which deploy many verticles). This is done by executing the jar file built at maven package phase. This is ok. I can run it with maven-ant-run plugin :
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>start-vertx-app</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<echo message="Starting in dir...${project.build.directory}"/>
<exec executable="${java.home}/bin/java"
dir="${project.build.directory}"
spawn="false">
<arg
line="-jar ${project.artifactId}-${project.version}.jar
run fr.edu.vortex.http.api.MainVerticle
-Dconf ${project.build.testOutputDirectory}/conf/profiles/${project.artifactId}-config-${user.name}.conf
-Dlogback.configurationFile
${vortex.conf.dir}/logback-conf/logback-http-api.xml
-Dvertx.hazelcast.config
${vortex.conf.dir}/cluster.xml
-Dhazelcast.logging.type
slf4j
-Dvertx.logger-delegate-factory-class-name
io.vertx.core.logging.SLF4JLogDelegateFactory
--cluster
"/>
</exec>
</target>
</configuration>
</execution>
<execution>
<id>stop-vertx-app</id>
<phase>post-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<exec executable="wmic"
dir="${project.build.directory}"
spawn="false">
<arg value="process"/>
<arg value="where"/>
<arg
value="CommandLine like '%${project.artifactId}%' and not name='wmic.exe'"/>
<arg value="delete"/>
</exec>
</target>
</configuration>
</execution>
</executions>
</plugin>
Then at startup, the micro service (jar file deploying several verticles) is starting in cluster mode with hazelcast (for event bus distribution). Here the starting log :
[INFO] --- antrun:3.1.0:run (start-vertx-app) @ vortex-http-api ---
[INFO] Executing tasks
[WARNING] [echo] Starting in dir...C:\prive\workspace-omogen-fichier\vortex-http-api\target
[INFO] [exec] 2025-06-16T16:52:41.775+0200 | INFOS | i.v.c.i.l.c.RunCommand | Starting clustering...
[INFO] [exec] 2025-06-16T16:52:42.412+0200 | AVERTISSEMENT | c.h.c.AbstractXmlConfigHelper | Name of the hazelcast schema location[http://www.hazelcast.com/schema/config/hazelcast-config-4.0.xsd] is incorrect, using default
[INFO] [exec] 2025-06-16T16:52:42.691+0200 | AVERTISSEMENT | c.h.i.i.HazelcastInstanceFactory | Hazelcast is starting in a Java modular environment (Java 9 and newer) but without proper access to required Java packages. Use additional Java arguments to provide Hazelcast access to Java internal API. The internal API access is used to get the best performance results. Arguments to be used:
[INFO] [exec] --add-modules java.se --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.management/sun.management=ALL-UNNAMED --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED
[INFO] [exec] 2025-06-16T16:52:43.072+0200 | INFOS | c.h.system | [172.30.103.113]:5701 [dev] [4.2.8] Hazelcast 4.2.8 (20230529 - 90df6cd) starting at [172.30.103.113]:5701
[INFO] [exec] 2025-06-16T16:52:43.361+0200 | INFOS | c.h.s.d.i.DiscoveryService | [172.30.103.113]:5701 [dev] [4.2.8] No discovery strategy is applicable for auto-detection
[INFO] [exec] 2025-06-16T16:52:44.038+0200 | INFOS | c.h.i.i.Node | [172.30.103.113]:5701 [dev] [4.2.8] Using Multicast discovery
[INFO] [exec] 2025-06-16T16:52:44.042+0200 | AVERTISSEMENT | c.h.c.CPSubsystem | [172.30.103.113]:5701 [dev] [4.2.8] CP Subsystem is not enabled. CP data structures will operate in UNSAFE mode! Please note that UNSAFE mode will not provide strong consistency guarantees.
[INFO] [exec] 2025-06-16T16:52:44.297+0200 | INFOS | c.h.i.d.Diagnostics | [172.30.103.113]:5701 [dev] [4.2.8] Diagnostics disabled. To enable add -Dhazelcast.diagnostics.enabled=true to the JVM arguments.
[INFO] [exec] 2025-06-16T16:52:44.304+0200 | INFOS | c.h.c.LifecycleService | [172.30.103.113]:5701 [dev] [4.2.8] [172.30.103.113]:5701 is STARTING
[INFO] [exec] WARNING: An illegal reflective access operation has occurred
[INFO] [exec] WARNING: Illegal reflective access by com.hazelcast.internal.networking.nio.SelectorOptimizer (file:/C:/prive/workspace-omogen-fichier/vortex-http-api/target/vortex-http-api-1.23.0-SNAPSHOT.jar) to field sun.nio.ch.SelectorImpl.selectedKeys
[INFO] [exec] WARNING: Please consider reporting this to the maintainers of com.hazelcast.internal.networking.nio.SelectorOptimizer
[INFO] [exec] WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
[INFO] [exec] WARNING: All illegal access operations will be denied in a future release
[INFO] [exec] 2025-06-16T16:52:46.554+0200 | INFOS | c.h.i.c.ClusterService | [172.30.103.113]:5701 [dev] [4.2.8]
[INFO] [exec]
[INFO] [exec] Members {size:1, ver:1} [
[INFO] [exec] Member [172.30.103.113]:5701 - d01c71c3-4f8f-4cfe-85c4-8a286c5d00c2 this
[INFO] [exec] ]
[INFO] [exec]
[INFO] [exec] 2025-06-16T16:52:46.563+0200 | INFOS | c.h.c.LifecycleService | [172.30.103.113]:5701 [dev] [4.2.8] [172.30.103.113]:5701 is STARTED
[INFO] [exec] 2025-06-16T16:52:46.655+0200 | INFOS | c.h.i.p.i.PartitionStateManager | [172.30.103.113]:5701 [dev] [4.2.8] Initializing cluster partition table arrangement...
[INFO] [exec] 2025-06-16 16:52:46,722 | Q05405 | x-eventloop-thread-2 | INFO | f.e.v.h.api.MainVerticle | [correlationId:''] Starting passerelle
[INFO] [exec] 2025-06-16 16:52:46,724 | Q05405 | x-eventloop-thread-2 | INFO | f.e.v.h.api.MainVerticle | [correlationId:''] Registering passerelle codecs
[INFO] [exec] 2025-06-16 16:52:46,725 | Q05405 | x-eventloop-thread-2 | INFO | f.e.v.h.api.MainVerticle | [correlationId:''] Creating metrics registry
[INFO] [exec] Vertx.currentContext().config() read : {}
[INFO] [exec] jvm arguments : []
[INFO] [exec] 2025-06-16T16:52:46.871+0200 | GRAVE | i.v.c.i.l.c.VertxIsolatedDeployer | Failed in deploying verticle
[INFO] [exec] 2025-06-16T16:52:46.886+0200 | INFOS | c.h.c.LifecycleService | [172.30.103.113]:5701 [dev] [4.2.8] [172.30.103.113]:5701 is SHUTTING_DOWN
[INFO] [exec] 2025-06-16T16:52:46.890+0200 | INFOS | c.h.i.p.i.MigrationManager | [172.30.103.113]:5701 [dev] [4.2.8] Shutdown request of Member [172.30.103.113]:5701 - d01c71c3-4f8f-4cfe-85c4-8a286c5d00c2 this is handled
[INFO] [exec] 2025-06-16T16:52:46.895+0200 | INFOS | c.h.i.i.Node | [172.30.103.113]:5701 [dev] [4.2.8] Shutting down multicast service...
[INFO] [exec] 2025-06-16T16:52:46.896+0200 | INFOS | c.h.i.i.Node | [172.30.103.113]:5701 [dev] [4.2.8] Shutting down connection manager...
[INFO] [exec] 2025-06-16T16:52:46.901+0200 | INFOS | c.h.i.i.Node | [172.30.103.113]:5701 [dev] [4.2.8] Shutting down node engine...
[INFO] [exec] 2025-06-16T16:52:48.761+0200 | INFOS | c.h.i.i.NodeExtension | [172.30.103.113]:5701 [dev] [4.2.8] Destroying node NodeExtension.
[INFO] [exec] 2025-06-16T16:52:48.762+0200 | INFOS | c.h.i.i.Node | [172.30.103.113]:5701 [dev] [4.2.8] Hazelcast Shutdown is completed in 1874 ms.
[INFO] [exec] 2025-06-16T16:52:48.763+0200 | INFOS | c.h.c.LifecycleService | [172.30.103.113]:5701 [dev] [4.2.8] [172.30.103.113]:5701 is SHUTDOWN
[INFO] Executed tasks
[INFO]
[INFO] --- failsafe:3.5.3:integration-test (default) @ vortex-http-api ---
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running fr.edu.vortex.http.api.fileserver.UploadInfoVerticleIntegrationTest
We read that Hazelcast is starting, but vertx failed in verticle deployment. In the start method of the MainVerticle, I put some log, and I read that output value :
[INFO] [exec] Vertx.currentContext().config() read : {}
[INFO] [exec] jvm arguments : []
So with the executable command of the plugin, I don't read the jvm argument, e.g. "-Dconf" jvm argument. Why my debug output print nor JVM arguments nor vertx configuration ? So the startup failed.
thank you for your help.
Here a good configuration to start and stop 2 vertx applications (which both deploy several verticles).
The commented part is for optional waiting for applications starts (we can force test to wait @beforeAll if we prefer).
<profiles>
<!-- A profile for windows as the stop command is different -->
<profile>
<id>windows-integration-tests</id>
<activation>
<os>
<family>windows</family>
</os>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>${properties-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven-failsafe.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${exec-maven-plugin.version}</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<urls>
<url>file:///${basedir}\src\test\resources\test-conf.properties</url>
</urls>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo>Displaying value of 'testproperty' property</echo>
<echo>[testproperty] ${vortex.conf.dir}/../${vertx.hazelcast.config}</echo>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>start-core</id>
<phase>pre-integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${java.home}/bin/java</executable>
<!-- optional -->
<workingDirectory>${user.home}/.m2/repository/fr/edu/vortex-core/${vortex.revision}</workingDirectory>
<arguments>
<argument>-jar</argument>
<argument>vortex-core-${vortex.revision}.jar</argument>
<argument>run fr.edu.vortex.core.MainVerticle</argument>
<argument>-Dconf=${vortex.conf.dir}/${vortex-core-configurationFile}</argument>
<argument>-Dlogback.configurationFile=${vortex.conf.dir}/../${vortex-core-logback.configurationFile}</argument>
<argument>-Dvertx.hazelcast.config=${vortex.conf.dir}/../${vertx.hazelcast.config}</argument>
<argument>-Dhazelcast.logging.type=slf4j</argument>
<argument>-Dvertx.logger-delegate-factory-class-name=io.vertx.core.logging.SLF4JLogDelegateFactory</argument>
<argument>-cluster</argument>
</arguments>
<async>true</async>
</configuration>
</execution>
<execution>
<id>start-http</id>
<phase>pre-integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${java.home}/bin/java</executable>
<!-- optional -->
<workingDirectory>${user.home}/.m2/repository/fr/edu/vortex-http-api/${vortex.revision}</workingDirectory>
<arguments>
<argument>-jar</argument>
<argument>vortex-http-api-${vortex.revision}.jar</argument>
<argument>run fr.edu.vortex.http.api.MainVerticle</argument>
<argument>-Dconf=${vortex.conf.dir}/${vortex-http-configurationFile}</argument>
<argument>-Dlogback.configurationFile=${vortex.conf.dir}/../${vortex-http-logback.configurationFile}</argument>
<argument>-Dvertx.hazelcast.config=${vortex.conf.dir}/../cluster.xml</argument>
<argument>-Dhazelcast.logging.type=slf4j</argument>
<argument>-Dvertx.logger-delegate-factory-class-name=io.vertx.core.logging.SLF4JLogDelegateFactory</argument>
<argument>-Dagentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005</argument>
<argument>-cluster</argument>
</arguments>
<async>true</async>
</configuration>
</execution>
<!-- <execution>-->
<!-- <id>wait-server-up</id>-->
<!-- <phase>pre-integration-test</phase>-->
<!-- <goals>-->
<!-- <goal>java</goal>-->
<!-- </goals>-->
<!-- <configuration>-->
<!-- <mainClass>fr.edu.vortex.WaitServerUpForIntegrationTests</mainClass>-->
<!-- <arguments>20000</arguments>-->
<!-- </configuration>-->
<!-- </execution>-->
<execution>
<id>stop-http-windows</id>
<phase>post-integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>wmic</executable>
<!-- optional -->
<workingDirectory>${project.build.directory}</workingDirectory>
<arguments>
<argument>process</argument>
<argument>where</argument>
<argument>CommandLine like '%vortex-http%' and not name='wmic.exe'
</argument>
<argument>delete</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>stop-core-windows</id>
<phase>post-integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>wmic</executable>
<!-- optional -->
<workingDirectory>${project.build.directory}</workingDirectory>
<arguments>
<argument>process</argument>
<argument>where</argument>
<argument>CommandLine like '%vortex-core%' and not name='wmic.exe'</argument>
<argument>delete</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
And content of property file :
vortex.conf.dir=C:\\prive\\workspace-omogen-fichier\\conf-avec-vortex-http-simple\\conf\\vortex-conf
vortex-core-configurationFile=core.conf
vortex-core-logback.configurationFile=logback-conf\\logback-core.xml
vortex-http-configurationFile=http.conf
vortex-http-logback.configurationFile=logback-conf\\logback-http-api.xml
vortex-management-configurationFile=management.conf
vortex-management-logback.configurationFile=logback-conf\\logback-management.xml
vertx.hazelcast.config=cluster.xml