title: Maven wildfly deployment with multiple servers (standalone)
body: <p>in my environment I have two wildfly server where I want to deploy with the wildfly-maven-plugin.</p>
  
  <p>The servers differ in the name dev01 and dev02 but have the same port 9993 and username and password.</p>
  
  <p>My understanding is that the wildfly-maven-plugin support only single server deployment.</p>
  
  <p>If the problem are not big enough we use a module/submodule structure where the war file will be build in a submodule.</p>
  
  <p>I'm using two profiles wildfly-deploy-dev01 and wildfly-deploy-dev02.</p>
  
  <pre><code>&lt;profiles&gt;
      &lt;profile&gt;
          &lt;id&gt;wildfly-deploy-dev01&lt;/id&gt;
          &lt;build&gt;
              &lt;plugins&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.wildfly.plugins&lt;/groupId&gt;
                      &lt;artifactId&gt;wildfly-maven-plugin&lt;/artifactId&gt;
                      &lt;configuration&gt;
                          &lt;skip&gt;true&lt;/skip&gt;
                      &lt;/configuration&gt;
                      &lt;executions&gt;
                          &lt;execution&gt;
                              &lt;phase&gt;install&lt;/phase&gt;
                              &lt;goals&gt;
                                  &lt;goal&gt;deploy&lt;/goal&gt;
                              &lt;/goals&gt;
                              &lt;configuration&gt;
                                  &lt;skip&gt;true&lt;/skip&gt;
                              &lt;/configuration&gt;
                          &lt;/execution&gt;
                      &lt;/executions&gt;
                  &lt;/plugin&gt;
              &lt;/plugins&gt;
          &lt;/build&gt;
      &lt;/profile&gt;
  
      &lt;profile&gt;
          &lt;id&gt;wildfly-deploy-dev02&lt;/id&gt;
          &lt;build&gt;
          [...]
  &lt;profiles&gt;
  </code></pre>
  
  <p>In the main module I skipped it.</p>
  
  <p>In the war submodule:</p>
  
  <pre><code>    &lt;profiles&gt;
      &lt;profile&gt;
          &lt;id&gt;wildfly-deploy-dev01&lt;/id&gt;
          &lt;build&gt;
              &lt;finalName&gt;${project.artifactId}-v1.0&lt;/finalName&gt;
              &lt;plugins&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.wildfly.plugins&lt;/groupId&gt;
                      &lt;artifactId&gt;wildfly-maven-plugin&lt;/artifactId&gt;
                      &lt;configuration&gt;
                          &lt;skip&gt;false&lt;/skip&gt;
                          &lt;id&gt;wildfly-credentials&lt;id&gt;
                          &lt;hostname&gt;dev01.example.com&lt;/hostname&gt;
                          &lt;protocol&gt;remote+https&lt;/protocol&gt;
                          &lt;port&gt;9993&lt;/port&gt;
                       &lt;/configuration&gt;
                      &lt;executions&gt;
                          &lt;execution&gt;
                              &lt;phase&gt;install&lt;/phase&gt;
                              &lt;goals&gt;
                                  &lt;goal&gt;deploy&lt;/goal&gt;
                              &lt;/goals&gt;
                          &lt;/execution&gt;
                      &lt;/executions&gt;
                  &lt;/plugin&gt;
              &lt;/plugins&gt;
          &lt;/build&gt;
      &lt;/profile&gt;
       &lt;profile&gt;
          &lt;id&gt;wildfly-deploy-dev01&lt;/id&gt;
          &lt;build&gt;
            [same as above for hostname dev02.example.com]
   &lt;/profiles&gt;
  </code></pre>
  
  <p>First I was thinking everthing works fine but then I found out that only the last server will be deployed.</p>
  
  <pre><code>mvn wildfly:deploy -P wildfly-deploy-dev01,wildfly-deploy-dev02
  </code></pre>
  
  <p>I played around by setting the configration after the execution tag without success. It looks that the second profile overwrite the first one.</p>
  
  <p>Futher I hardcoded the finalname because the parsedVersion is not parsed.</p>
  
  <pre><code>&lt;finalName&gt;${project.artifactId}-v${parsedVersion.majorVersion}.${parsedVersion.minorVersion}&lt;/finalName&gt;
  </code></pre>
  
  <p>At the moment I'm lost with Maven. Has anybody an idea how I can deploy with the plugin on two servers?</p>
  
  <p>Thanks,
  Markus</p>
  
  <p>Ways which I tried:</p>
  
  <ul>
  <li><a href="https://github.com/tsotzolas/wildfly_maven_plugins_examples/blob/master/deployToMultiplesServer/pom.xml" rel="nofollow noreferrer">https://github.com/tsotzolas/wildfly_maven_plugins_examples/blob/master/deployToMultiplesServer/pom.xml</a></li>
  <li><a href="https://stackoverflow.com/questions/43194906/wildfly-maven-plugin-not-deploying-when-multiple-profiles-selected">wildfly-maven-plugin not deploying when multiple profiles selected</a></li>
  <li><a href="https://stackoverflow.com/questions/50153395/cannot-access-parsedversion-value-in-pom-properties">Cannot access parsedVersion value in pom properties</a></li>
  </ul>