1

I am using wildfly maven plugin to add datasource in my standalone.xml file. I want also to add the pool size that will be something like that in the standalone file:

<pool>
  <min-pool-size>10</min-pool-size>
  <max-pool-size>30</max-pool-size>
  <prefill>true</prefill>
</pool>

How can I do that in my goal in the pom.xml ?

Djiby Thiaw
  • 183
  • 2
  • 10

1 Answers1

2

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>
Steve C
  • 17,352
  • 4
  • 29
  • 34
  • thanks i will try that solution. so natively without a cli maven plugin can't do it directly ? – Djiby Thiaw Jan 02 '17 at 12:27
  • The `config.cli` script can be executed from the command line; you don't need the maven plugin to do it. Try `$JBOSS_HOME/bin/jboss-cli.sh -c --file=/path/to/config.cli`. – Steve C Jan 02 '17 at 12:42