Maven users: invoke the WildFly Provisioning Plugin
Assuming the previous Provisioning Configuration File is saved as server-provisioning.xml
, you will just have to refer the plugin to it, pick an output directory name and bing the plugin to the build lifecycle.
Example 3. Example Maven Provisioning
<build>
<plugins>
<plugin>
<groupId>org.wildfly.build</groupId>
<artifactId>wildfly-server-provisioning-maven-plugin</artifactId>
<executions>
<execution>
<id>server-provisioning</id>
<goals>
<goal>build</goal>
</goals>
<phase>compile</phase>
<configuration>
<config-file>server-provisioning.xml</config-file>
<server-name>wildfly-custom</server-name>
</configuration>
</execution>
JPA version override
With WildFly 12 being built with JavaEE7 in mind, it ships the JPA 2.1 API.
Hibernate ORM 5.3 requires JPA 2.2, and it is not possible at this time to replace the JPA API using the Maven provisioning plugin so you’ll have to apply a “WildFly patch” as well.
A WildFly patch can be applied from the WildFly CLI; here we show how to automate it all with Maven plugins.
Example 4. Example Maven script to patch the JPA version in WildFly:
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>fetch-jpa-patch</id>
<phase>process-test-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-api-2.2-wildflymodules</artifactId>
<classifier>wildfly-12.0.0.Final-patch</classifier>
<version>1.0.0.Beta2</version>
<type>zip</type>
<outputDirectory>${project.build.directory}</outputDirectory>
<overWrite>true</overWrite>
<destFileName>hibernate-jpa-api-2.2-wildflymodules-patch.zip</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<executions>
<execution>
<id>apply-wildfly-jpa22-patch-file</id>
<phase>pre-integration-test</phase>
<goals>
<goal>execute-commands</goal>
</goals>
<configuration>
<offline>true</offline>
<jbossHome>${jbossHome.provisionedPath}</jbossHome>
<!-- The CLI script below will fail if the patch was already applied in a previous build -->
<fail-on-error>false</fail-on-error>
<commands>
<command>patch apply --override-all ${project.build.directory}/hibernate-jpa-api-2.2-wildflymodules-patch.zip</command>
</commands>
</configuration>
</execution>
</executions>
</plugin>