I want to have a way to run maven so that it will:
wildfly:run
)The problem is that:
wildfly:run
blocks so no other maven goals can be executedA possible work around that comes to my mind is:
wildfly:start
Log into your instance of Wildfly and, from the main page, click Start (under Deployments — Figure 1). Accessing the Deployment tool in the Wildfly web-based interface. On the resulting page, drag the helloworld. war file into the Deployment pane on the left side (Figure 2).
You can use the parameter beforeDeployment of the run goal
(source):
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<configuration>
<beforeDeployment>
<commands>
<command>data-source add --jndi-name=java:jboss/datasources/OracleDS --name=testDB --connection-url=jdbc:h2:mem:test;DB_CLOSE_DELAY=-1 --driver-name=h2 --user-name=sa --password=sa</command>
</commands>
</beforeDeployment>
</configuration>
</plugin>
If you need additional libraries for your database driver you can do something like that (source):
module add --name=org.postgres --resources=/tmp/postgresql-9.3-1101.jdbc41.jar --dependencies=javax.api,javax.transaction.api
/subsystem=datasources/jdbc-driver=postgres:add(driver-name="postgres",driver-module-name="org.postgres",driver-class-name=org.postgresql.Driver)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With