Getting started
Get your copy of the latest WebLogic (together with Coherence and OEPE) and install it. Download and configure Apache Maven 2.x.
Next is to configure the new plugins. Everything gets a lot simpler if you start with a blank domain. Start the configuration wizard and create one. Execute the user_projects\domains\base_domain\bin\setDomainEnv.cmd/.sh to prepare your environment. Now we can go on and configure the plugin jar file. This could be done with the WebLogic JarBuilder Tool (wljarbuilder) which ist located at
MW_HOME/wlserver_10.3/server/lib/
change to that folder and execute: java -jar wljarbuilder.jar -profile weblogic-maven-plugin
. This will generate your barely 59 MB big weblogic-maven-plugin.jar
. Don't think about the weird output ;)Open the jar file with your favorite ZIP tool and extract the META-INF\maven\com.oracle.weblogic\weblogic-maven-plugin\pom.xml to MW_HOME/wlserver_10.3/server/lib. If you look at the file you get the maven dependency information:
<groupId>com.oracle.weblogic</groupId>
<artifactId>weblogic-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
<version>10.3.4</version>
These fields identify the plug-in and mark a specific place in a Maven repository, acting like a coordinate system for Maven projects.
Now you have to install the plugin to your local maven repository. Execute:
mvn install:install-file -Dfile=weblogic-maven-plugin.jar -DpomFile=pom.xml
If you have never ever used Maven before, you should probably go and read other pages before but if you came here and you are wondering about what's happening after you executed this command for the first time ever: Maven is downloading the internet to your local repository and finally installs the generated jar file there, too.
Using the WebLogic Maven Plugin
You can use the plugin in two modes. First is from the cmd line. You can use the following goals: deploy, list-apps, redeploy,start-app,stop-app,undeploy,update-app.
If you followed my explanation you can simply type the following:
mvn com.oracle.weblogic:weblogic-maven-plugin:help
Or you can include the plugin in your own applications's pom.xml file:
...
<build>
<plugins>
<plugin>
<groupid>com.oracle.weblogic</groupId>
<artifactid>weblogic-maven-plugin</artifactId>
<version>10.3.4</version>
<configuration>
<adminurl>t3://localhost:7001</adminurl>
<user>system</user>
<password>weblogic1</password>
<upload>true</upload>
<action>deploy</action>
<remote>false</remote>
<verbose>true</verbose>
<source>${project.build.directory}/${project.build.finalName}.${project.packaging}</source>
<name>${project.build.finalName}</name>
</configuration>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
...
</plugins>
</build>
...
You can add the plug-in into any life cycle phase of the project. Optionally, you can add a goal to any of the default Maven life cycle phases by adding an executions tag in the pom.xml file. The goal is then bound to that particular phase of the Maven life cycle. As shown above the goal is bound to the "install" phase of the life cycle. By doing this, every time you run the mvn install command, the deployment plug-in is also called.
Wondering about the long command?
The cmd line command is quite long. You can and should shorten the invocation name of the plugin. A couple of steps have to be taken to achieve this.
You have to change the pom.xml file and add:
<build>
<plugins>
<plugin>
<artifactid>maven-plugin-plugin</artifactId>
<version>2.3</version>
<configuration>
<goalprefix>weblogic</goalPrefix>
</configuration>
</plugin>
</plugins>
</build>
After that modify the settings.xml file located in your $HOME/.m2 directory with the following lines:
<plugingroups>
<plugingroup>com.oracle.weblogic</pluginGroup>
</pluginGroups>
before you provision the plug-in in your Maven repository.
After all this is done, you can call all commands with a shortened version:
mvn weblogic:deploy
Conclusion
Even if the documentation states, that the plugin should use Maven 2.x I tried everything with Maven 3 and did not discover any problems in general.
I will give it a test drive production near and will report further findings. At the moment everything looks very promising and simple. Thanks guys for providing this one!
It doesn't support the most important feature for a developer, WLS Split Deploy, better if you use the beabuild-plugin
ReplyDeleteLuca,
ReplyDeletethat's definitely a point. I was hoping for any good ideas related to developer productivity in this, too. But I guess it's not only the fault of the product. It's simply the way maven works.
Thanks for the comment,
M
is the WebLogic free or open?
ReplyDeleteMarcelo,
ReplyDeleteno, it's not. It's the commercial application server from Oracle.
If you are looking for a free and open Java EE appserver, give GlassFish a try!
-M.
How can Patchset 3 be identified? Does the WL server state it during startup or in the Admin Console?
ReplyDeleteA colleague who tried the Maven plugin has found some issues, so I'm wondering, if we had the latest version of 11g...
Thanks,
Werner
Hi Werner,
ReplyDeleteit's printed to stdout during startup:
"WebLogic Server 10.3.4.0.
the 4.0 is the PS3 indicator :)
You can also fire up the http://localhost:7001/console and look bottom left into the blue area. That also states the version number.
Thanks,
M
Hi everyone.
ReplyDeleteI having issues while running the start-app goal. It´s hanging for at least 1h and after that my eclipse console says that the goal finished successfully but the app( an ear file) is in prepared state on my weblogic console.
Any help would be appreciated.
PS : What Im using :
Weblogic 10.3
Maven 2.2.1
Hi Everyone,
ReplyDeletewhat does the tag:
deploy
in the pom.xml mean ?
I try to figure out, how I define the tag only in deploy goal because during the undeploy I got an Error, that I must not define the source tag.
Any help would be appreciated.