From 45d4ccbae4e860a3f647a6e3fc522bea70d26859 Mon Sep 17 00:00:00 2001 From: Miguel Reboiro Jato Date: Wed, 17 Sep 2025 21:02:00 +0200 Subject: [PATCH] Fixes and simplifies WildFly execution with Maven The configuration to execute WildFly using Maven commands was causing problems in Windows environments. This problem has been fixed by upgrading the plugin version, which implied rebuilding its configuration. As part of this change, the configuration was also simplified, and now starting the application and redeploying it is faster. In addition, submodules that do not require WildFly to run the tests no longer copy it. This reduces the execution time. --- README.md | 6 ++ domain/pom.xml | 20 +++++- ear/pom.xml | 41 ++++++++---- pom.xml | 169 ++++++++++++++++--------------------------------- tests/pom.xml | 24 ++++++- 5 files changed, 133 insertions(+), 127 deletions(-) diff --git a/README.md b/README.md index 092215f..85dd011 100644 --- a/README.md +++ b/README.md @@ -199,6 +199,12 @@ This will launch the complete construction cycle without running the tests, star **Important**: You shouldn't have a local WildFly instance running or Maven will not be able to start its own WildFly and will try to deploy the application in the running instance. This will cause changes to the WildFly configuration that may leave it in an unstable state. +Once WildFly is running, you can quickly redeploy the application (typically after making some changes) by executing the following command: + +```bash +mvn install wildfly:deploy-only -DskipTests=true +``` + To stop the WildFly launched you can execute the following command: ```bash diff --git a/domain/pom.xml b/domain/pom.xml index 6147fbe..c8bed6a 100644 --- a/domain/pom.xml +++ b/domain/pom.xml @@ -1,5 +1,6 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" +> 4.0.0 es.uvigo.esei.xcs @@ -43,6 +44,23 @@ org.jacoco jacoco-maven-plugin + + + + org.apache.maven.plugins + maven-dependency-plugin + + true + + + + + org.apache.maven.plugins + maven-resources-plugin + + true + + diff --git a/ear/pom.xml b/ear/pom.xml index e9b71ac..0dae354 100644 --- a/ear/pom.xml +++ b/ear/pom.xml @@ -1,5 +1,6 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" +> 4.0.0 es.uvigo.esei.xcs @@ -8,10 +9,10 @@ ear ear - + EAR XCS Sample - EAR - + es.uvigo.esei.xcs @@ -36,7 +37,7 @@ war - + @@ -64,13 +65,31 @@ - org.wildfly.plugins - wildfly-maven-plugin - - false - ${project.parent.artifactId}-${project.version}.${project.packaging} - - + org.wildfly.plugins + wildfly-maven-plugin + + false + + ${project.parent.artifactId}-${project.version}.${project.packaging} + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + true + + + + + org.apache.maven.plugins + maven-resources-plugin + + true + + diff --git a/pom.xml b/pom.xml index 0f7cbce..39ff4b2 100644 --- a/pom.xml +++ b/pom.xml @@ -73,7 +73,7 @@ 3.3.1 3.3.0 3.1.2 - 1.2.2.Final + 2.1.0.Final @@ -92,11 +92,11 @@ import - org.jboss.shrinkwrap.resolver - shrinkwrap-resolver-bom - ${shrinkwrap.resolver.bom.version} - pom - import + org.jboss.shrinkwrap.resolver + shrinkwrap-resolver-bom + ${shrinkwrap.resolver.bom.version} + pom + import org.jboss.arquillian.selenium @@ -105,7 +105,7 @@ pom import - + ${project.groupId} @@ -655,6 +655,13 @@ wildfly-mysql-run + + + com.mysql + mysql-connector-j + test + + @@ -676,135 +683,69 @@ - org.apache.maven.plugins - maven-dependency-plugin + org.wildfly.plugins + wildfly-maven-plugin - unpack - process-test-classes - - unpack - - - - - org.wildfly - wildfly-dist - ${wildfly.version} - zip - false - target - - - - - - copy-mysql - process-test-classes + start-wildfly + install - copy + start - - - com.mysql - mysql-connector-j - jar - false - ${project.build.directory}/wildfly-${wildfly.version}/standalone/deployments - - + + + + wildfly-admin + xcsadmin + false + + + - copy-mysql-for-execution - process-test-classes + add-mysql + install - copy + deploy-artifact - - - com.mysql - mysql-connector-j - jar - false - ${project.build.directory} - mysql-connector-j-${mysql.connector.java.version}.jar - - + com.mysql + mysql-connector-j + mysql-connector-j-${mysql.connector.java.version}.jar - - - - - org.apache.maven.plugins - maven-resources-plugin - - copy-wildfly-resources - process-test-classes + configure-wildfly + install - copy-resources + execute-commands - ${project.build.directory}/wildfly-${wildfly.version}/standalone/configuration - - - src/test/resources-wildfly-embedded-mysql - standalone.xml - - + true + + data-source add --jndi-name=java:jboss/datasources/xcs --name=xcs-sample --jta=true --use-ccm=true + --connection-url=jdbc:mysql://localhost:3306/xcs?useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Europe%2FMadrid --driver-name=mysql-connector-j-${mysql.connector.java.version}.jar + --user-name=xcs --password=xcs + /core-service=management/security-realm=RemotingRealm:add + /core-service=management/security-realm=RemotingRealm/authentication=jaas:add(name="AppRealmLoopThrough") + /subsystem=remoting/http-connector=http-remoting-connector:write-attribute(name="security-realm", value="RemotingRealm") + /subsystem=security/security-domain=AppRealmLoopThrough:add(cache-type=default) + /subsystem=security/security-domain=AppRealmLoopThrough/authentication=classic:add(login-modules=[{"code"=>"Client", "flag" => + "required", "module-options" => [("multi-threaded" => "true")]}]) + /subsystem=security/security-domain=xcs-sample-security-domain:add + /subsystem=security/security-domain=xcs-sample-security-domain/authentication=classic:add(login-modules=[{"code"=>"Database", "flag" + => "required", "module-options" => [("dsJndiName" => "java:jboss/datasources/xcs"),("principalsQuery" => "SELECT password FROM User WHERE + login=?"),("rolesQuery" => "SELECT role, 'Roles' FROM User WHERE login=?"),("hashAlgorithm" => "MD5"),("hashEncoding" => + "hex"),("ignorePasswordCase" => "true")]}]) + - - - - org.wildfly.plugins - wildfly-maven-plugin - - - - - deploy ${project.build.directory}/mysql-connector-j-${mysql.connector.java.version}.jar - data-source add --jndi-name=java:jboss/datasources/xcs --name=xcs-sample --jta=true --use-ccm=true - --connection-url=jdbc:mysql://localhost:3306/xcs?useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Europe%2FMadrid --driver-name=mysql-connector-j-${mysql.connector.java.version}.jar - --user-name=xcs --password=xcs - /core-service=management/security-realm=RemotingRealm:add - /core-service=management/security-realm=RemotingRealm/authentication=jaas:add(name="AppRealmLoopThrough") - /subsystem=remoting/http-connector=http-remoting-connector:write-attribute(name="security-realm", value="RemotingRealm") - /subsystem=security/security-domain=AppRealmLoopThrough:add(cache-type=default) - /subsystem=security/security-domain=AppRealmLoopThrough/authentication=classic:add(login-modules=[{"code"=>"Client", "flag" => - "required", "module-options" => [("multi-threaded" => "true")]}]) - /subsystem=security/security-domain=xcs-sample-security-domain:add - /subsystem=security/security-domain=xcs-sample-security-domain/authentication=classic:add(login-modules=[{"code"=>"Database", "flag" - => "required", "module-options" => [("dsJndiName" => "java:jboss/datasources/xcs"),("principalsQuery" => "SELECT password FROM User WHERE - login=?"),("rolesQuery" => "SELECT role, 'Roles' FROM User WHERE login=?"),("hashAlgorithm" => "MD5"),("hashEncoding" => - "hex"),("ignorePasswordCase" => "true")]}]) - - - - - :reload - - - - - - wildfly-admin - xcsadmin - false - - - - - - start-wildfly + deploy-wildfly install - start deploy-only diff --git a/tests/pom.xml b/tests/pom.xml index d605111..174203e 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -1,5 +1,6 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" +> 4.0.0 es.uvigo.esei.xcs @@ -34,4 +35,25 @@ compile + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + true + + + + + org.apache.maven.plugins + maven-resources-plugin + + true + + + + -- 2.18.1