07 July 2014

Coloque as propriedades do seu server no arquivo settings.xml do maven (encontrado no diretório .m2 ) como esse:

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>wildfly-remote</id>
<properties>
<wildfly-hostname>192.168.0.123</wildfly-hostname>
<wildfly-port>9990</wildfly-port>
<wildfly-username>remoteuser</wildfly-username>
<wildfly-password>remotepassword</wildfly-password>
</properties>
</profile>
<profile>
<id>wildfly-local</id>
<properties>
<wildfly-home>${env.WILDFLY_HOME}</wildfly-home>
<wildfly-hostname>127.0.0.1</wildfly-hostname>
<wildfly-port>9990</wildfly-port>
<wildfly-username>clairton</wildfly-username>
<wildfly-password>localpassword</wildfly-password>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>wildfly-local</activeProfile>
<activeProfile>wildfly-remote</activeProfile>
</activeProfiles>
</settings>
view raw settings.xml hosted with ❤ by GitHub
No arquivo pom.xml coloque os plugins dentro do build>plugins> e defina os parametros de configuração do servidor com o maven properties (sem adiciona-lo em seu pom):
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.0.2.Final</version>
<configuration>
<hostname>${wildfly-hostname}</hostname>
<port>${wildfly-port}</port>
<username>${wildfly-username}</username>
<password>${wildfly-password}</password>
</configuration>
<executions>
<execution>
<!--<phase>package</phase> -->
<!--<goals> -->
<!--<goal>deploy</goal> -->
<!--</goals> -->
</execution>
</executions>
</plugin>
view raw pom.xml hosted with ❤ by GitHub

# Para deploy no servidor localhost executar o seguinte comando:
wildfly:deploy -P wildfly-local
# Para deploy no servidor remoto executar:
wildfly:deploy -P wildfly-remote
view raw deploy.sh hosted with ❤ by GitHub
Você também pode executar undeploy, redeploy… Para mais informações veja: https://docs.jboss.org/wildfly/plugins/maven/latest/ Fonte: http://lauraliparulo.altervista.org/jboss-wildfly-maven-plugin-to-deploy-on-localhostremote-server/