The documentation for the WebLogic Maven Plugin describes a technique whereby the goals exposed by the plugin can be called using the short name (or prefix) weblogic.
This means that instead of calling a goal using this form:
You can use the much more convenient form of:
Sounds great. However there is a documentation bug (logged and fixed for next release) which misses out one crucial step in the process.
After extracting the pom.xml file from weblogic-maven-plugin.jar and editing it to specify the <build> configuration that maps the plugin goalPrefix as weblogic;
And before you issue the “mvn install:install-file –Dfile=weblogic-maven-plugin.jar -DpomFile=pom.xml”;
You first need to execute a simple “mvn install” command in the directory in which the pom.xml file resides;
Then you use the “mvn install:install-file ….” goal to install the weblogic-maven-plugin.jar file.
Blow by Blow
Let’s recap those steps:
- Generate the weblogic-maven-plugin.jar using the MW_HOME/wlserver_10.3/server/lib/wljarbuilder.jar file.
- Extract the pom.xml file from weblogic-maven-plugin.jar and copy/move it into the current working directory:
$ jar xvf weblogic-maven-plugin.jar META-INF/maven/com.oracle.weblogic/weblogic-maven-plugin/pom.xml
$ mv META-INF/maven/com.oracle.weblogic/weblogic-maven-plugin/pom.xml .
- Edit both ~/.m2/settings.xml and pom.xml to add the entries as described in the documentation:
- Execute “mvn install” to initially configure the plugin in the Maven repository:
$ mvn install
** Extra info: if you look at the ~/.m2/repository/com/oracle/weblogic directory, you should now see a file called maven-metadata-local.xml in which the weblogic-maven-plugin is defined and mapped to the prefix weblogic. If you neglect this step, then this file is not created and the weblogic-maven-plugin is not able to be accessed using the weblogic prefix.
- Execute “mvn install:install-file” to install the weblogic-maven-plugin.jar file into the repository, using the pom.xml to supply the coordinates:
$ mvn install:install-file –Dfile=weblogic-maven-plugin.jar –DpomFile=pom.xml
With that one extra step done you should now be able to execute a weblogic-maven-plugin goal simply using the weblogic prefix.
I find a quick test using weblogic:help is the easiest way to verify it is working correctly:
It’s crucial that the additional “mvn install” step is performed before you install the actual weblogic-maven-plugin.jar library for this to work.
If you have installed the weblogic-maven-plugin as documented and either now want to use the short-name or tried the short-name and it didn’t work, then what I’d suggest is that you blow away the ~/.m2/repository/com/oracle directory and start again from scratch. That should get you a clean install in which the weblogic prefix is mapped correctly to the weblogic-maven-plugin.