Friday, January 7, 2011

deploy weblogic using maven2

I tried to deploy my app into weblogic app server using maven2. Yes, there are a few ways. You can use cargo and weblogic maven plugin. I just tried to use the simple 1 which is the cargo plugin. It seems that this plugin has a problem on the repo. I got so many problem of redirection problem (as the maven2 has a problem on doing redirection once the repository is moved to another server). This gave me a problem of the metadata in my local repository. It seems to many things to do and I just gave up on dealing with this plugin.

Having such problem on the cargo plugin. I try to use weblogic plugin as in the following:
http://mojo.codehaus.org/weblogic-maven-plugin

The following are the steps that I go through to get my app deployed onto my weblogic.
1. Insert the following piece of xml code onto the settings.xml. Insert the following configuration:

weblogic
https://nexus.codehaus.org/content/repositories/releases



weblogic
https://nexus.codehaus.org/content/repositories/releases


2. Insert the following piece of xml code into


org.apache.maven.plugins
maven-war-plugin
2.0.2


org.codehaus.mojo
weblogic-maven-plugin
2.9.1


deploy

deploy
start




mpl-web
${wls.adminServerHostName}
${wls.adminServerPort}
t3
${wls.userId}
${wls.password}
true
true
false
false
${wls.targetname}
true



weblogic
wlfullclient
${weblogic.version}


weblogic
com.bea.core.descriptor.wl
1.1.0.0




3. As you might see on the above configuration that the plugin needs 2 weblogic's plugins. Those are wlfullclient and com.bea.core.descriptor.wl. I just need to install the manually. You can find artifact com.bea.core.descriptor.wl in the directory of /modules. While the other artifact is a merged of all the jar files which located in the /wlserver_10.3/server/lib. So that, you can get the files simply do the following steps:
a. go to the mentioned directory.
b. execute the following command to merge all jars:

java -jar ../../../modules/com.bea.core.jarbuilder_X.X.X.X.jar
java -jar wlfullclient.jar

4. Create the war package of your app by executing the following command: mvn package
I use maven-war-plugin version 2.0.2 to package my application as the default version seems to have a problem.

5. Deploy the app to a running weblogic (Ensure that the weblogic server is running). Take a note that I am using a remote deployment instead of local one even the app server is on my local.
Execute the following command the get it deployed.
mvn weblogic:deploy

No comments: