79717591

Date: 2025-07-28 15:56:39
Score: 0.5
Natty:
Report link

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
Reasons:
  • Long answer (-1):
  • Has code block (-0.5):
  • User mentioned (1): @beforeAll
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: François F.