To set up a Java EE 5 Maven project that works in WebLogic using split-deployment we just need few easy steps.
We start by creating the actual project with a very simple JEE archetype that encloses the minimum necessary to start (from the project open-archetypes):
With this we have our EAR project with which we could theoretically already start using WebLogic autodeploy (taking the generated ear with the "package" and each time copying it into the domain’s folder "autodeploy"), but it is not the best way to work since from a developer's point of view one of the greatest features of this application is split-deploy/fast-swap.
To enable them we must make some changes only to the pom.xml of the generated project:
This activity needs editing three poms, starting from the parent where the plugin-repository is defined as following:
and configured within the plugin-management:
then referenced in the poms of the ear and web modules::
The ear-plugin already has an initial configuration generated from the archetype, this must be enriched with:
In the last step we configure a simple Maven goal such that our application is automatically deployed on WebLogic. To do this we first need to add some properties to point to our WLS installation:
and then configure antrun-plugin such that it deploys our project:
Putting all pieces together
At this point an install is sufficient:
and from here on you just need to redo the full deployment for any changes made on the code that fast-swap or the JVM can not exchange on the fly:
This command takes care of the first deployment of the application or just updates the modified modules.