Deploying applications to WebLogic with weblogic-maven-plugin

WebLogic has made the deployment of artifacts and resources significantly easier for Maven projects through the new plugin capabilities with weblogic-maven-plugin (WLS 11) and now the wls-maven-plugin (WLS 12). The newer version of the plugin has many additional features, but also has quite a few bugs and therefore I will use the capabilities of both plugins. The general usage of the plugins is to deploy our application resources (such as JDBC and JMS configurations), our optional packages, our web applications, and also to run wlst scripts against those deployments to change their deployment order.

The plugin is not something that can be downloaded directly, it is included within the installs for WebLogic Server 11 or WebLogic Server 12. So in order to get access to the plugin, I first install both servers locally. Once I do this, I can access the plugins:

1) With WebLogic Server 11, I can build the weblogic-maven-plugin using the wljarbuilder.jar

2) With WebLogic Server 12, I can find the plugin already available via out install directory at: $MIDDLEWARE_PATH_12C_ZIP/wlserver/server/lib/wls-maven-plugin.jar

Once I have access to these plugin jars, I will load them into our Maven repository manager (which is Nexus, but also could be Artifactory…for example). This way our plugin jars will be available to all our maven projects, and I will configure them through our plugin poms.

When using the plugin for deployments, I will need to gather some information such as what environments I will be deploying the resources to, what server names are, what cluster names are, what ports, what type of resource, the name I want the deployment to be, and other information. Since the deployments will change per environment, one beneficial strategy is to design a property file per environment. Once this is complete, I can use maven property substitution to derive our deployment information dynamically during the plugin runtime from the environment specific properties.

For more details on the Properties Maven Plugin. There is one nuance or issue with this plugin that you should be aware of, is it does not support properties within a jar file. If you follow this thread in, you will see a working plugin that uses the concepts of the “Properties Maven Plugin”, but allows the reading of properties from an external jar file: properties-ext-maven-plugin. This way I can run the external properties plugin prior to the weblogic-maven-plugin to read in our environment specific properties (one jar for each environment containing specific properties for that environment).

Now I can configure our weblogic-maven-plugin within our pom file:

<plugin> <groupid></groupid> <artifactid>weblogic-maven-plugin</artifactid> <version>${weblogic.version}</version> <executions> <execution> <id>deploy</id><phase>compile</phase> <goals> <goal>deploy</goal> </goals> <configuration> <adminurl>t3://${deploy.hostname}:${deploy.port}</adminurl> <user>${deploy.userId}</user><password>${deploy.password}</password> <upload>true</upload> <action>deploy</action> <targets>${target.names}</targets> <remote>true</remote> <verbose>true</verbose> <source>${}/lib/${}.war <name>${}</name> </configuration> </execution> </executions> </plugin>
  • deploy.hostname/deploy.port = properties that are read in per environment to point to different server targets
  • deploy.userId = the userid used to login to the weblogic server
  • deploy.password = the password used to login to the weblogic server
  • target.names = the target is usually the cluster name for the environment
  • = This is the name of the deployment of the console, which I may want to name differently than the war itself, since the war might contain Maven version/classifiers within the name.

Once I deploy this war, I may have the need to undeploy (which can be done via the console our through our plugin again:

<plugin> <groupid></groupid> <artifactid>weblogic-maven-plugin</artifactid> <version>${weblogic.version}</version> <execution> <id>undeploy</id><phase>clean</phase><goals><goal>undeploy</goal> </goals><configuration><adminurl>t3://${deploy.hostname}:${deploy.port}</adminurl><user>${deploy.userId}</user><password>${deploy.password}</password><upload>true</upload><action>undeploy</action><targets>${target.names}</targets><remote>true</remote><verbose>true</verbose><name>${}</name></configuration> </execution> </plugin>

This configuration isn’t really much different. I just don’t need to supply the source and need to change the action to undeploy.

Another feature that I may want to do and can just become tedious based on the size of our deployments is to change the deployment order. This is not something that is capable through the WebLogic Server 11 plugin, so in this case I will utilize the WebLogic Server 12 plugin. The main difference is that now I am using the WebLogic Server 12 plugin, it has the capabilities to create domains, run wlst scripting, and other features that require an installation of WebLogic Server 12. This does not necessarily mean you have to install a WebLogic Server 12 in your environments, it just means that if you are using this plugin locally or via a CI Tool such as Hudson, you will need to install a WebLogic Server 12 into that environment so that the plugin can utilize the wlst shell and other scripts in order to use the plugin. This could be an issue for developers running the scripts locally, so in this case, I utilize profiles to run plugin configurations that use WebLogic Server 12 plugin so that developers can do deployments via the WebLogic Server 11 (which has no additional dependencies) and advanced features via WebLogic Server 12.

<plugin><groupid></groupid> <artifactid>wls-maven-plugin</artifactid> <executions><execution><phase>package</phase><goals><goal>wlst</goal></goals></execution> </executions> <configuration>      from java.util import * from import * import
    print 'Updating deployment order .... '
    connect(System.getProperty("deploy.user"), System.getProperty("deploy.password"), System.getProperty("deploy.admin")) edit() startEdit() cd(System.getProperty("deploy.mbean")) cd(System.getProperty("")) set ('DeploymentOrder', System.getProperty("deploy.order")) save() activate() disconnect()

  • deploy.user = the userid used to login to the weblogic server
  • deploy.password = the password use to login to the weblogic server
  • deploy.admin = the admin url for logging into the weblogic domain
  • deploy.mbean = AppDeployments or Libraries based on whether this is a war or something like an Optional Package
  • = the exact name as it appears through JMX tree or console, for Optional Packages, this includes the version in a format such as deployName#deploySpecVersion@deployImplVersion

The space and indentation are important when including the script inline within the pom as opposed to having the wlst script as an external file. Another thing to mention is that the capability to open wlst shell, change the deployment order, and close the wlst shell appears to consume some resources and if I need to do this for multiple resources, I should do this in one connection. Otherwise I have run into issues where running this wlst plugin per resource (10+ resources) will crash our Hudson instance.

This plugin (and all the WebLogic Server 12 plugin goals) have to be run with a command line parameter to supply the installation directory for the WebLogic Server 12:


In another post, I will explain how I utilize this plugin to deploy our Optional Packages as well as deploy our JMS/JDBC resources.

buy dianabol uk


Share and Enjoy