One way to do this is to create a script called config.cli
and add the following content to it:
# Mark the commands below to be run as a batch
batch
# Add the application datasource (this example is for PostgreSQL)
data-source add \
--name=YourDS \
--driver-name=postgresql-9.4-1206-jdbc42.jar \
--connection-url=jdbc:postgresql://yourdb:5432/yourdb \
--jndi-name=java:jboss/datasources/YourDS \
--user-name=username \
--password=password \
--use-ccm=false \
--min-pool-size=10 \
--max-pool-size=30 \
--pool-prefill=true \
--blocking-timeout-wait-millis=5000 \
--new-connection-sql="set datestyle = ISO, European;"
# Execute the batch
run-batch
and then execute it using the wildfly-maven-plugin
:
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.1.0.Beta1</version>
<configuration>
<scripts>
<script>config.cli</script>
</scripts>
</configuration>
</plugin>