Automated build & deployment in OC4J 11g
Automated build & deployment is very important. Not only is it a condition for continuous integration, it helps prevent costly errors during development and build promotion.
Now pretty soon (hmmm, well, next year at least
, we will have this new Oracle stack: Oracle Fusion Middleware 11g. A lot of improvements, not only in ADF and SOA Suite, but also in the management of the application server and the different suites. One of the downsides is that you need to rewrite (and maybe re-consider) your existing automated build and deployment solutions. A lot of stuff has changed, the JMX interface for example. I wondered about the ant tasks….
I decided to write a very tiny ADF BC application in JDeveloper11g tp2 and deploy it to the standalone OC4J11g (Preview). Right away I ran into a problem: the runtime installer does not work (yet). Luckily, Steve Muench wrote a technote that explains how to fix that. It is written in May 2007, for preview 1. In preview 2, some of the libraries have ‘disappeared’. If you are following the steps that are described in the technote, you can skip copying %JDEV_HOME%\BC4J\lib\adfrcutils.jar and %JDEV_HOME%\BC4J\lib\connmbean.jar; they are no longer there.
Next I needed some tool to automate the build and deploy process. Since the Oracle application server and SOA Suite support Ant driven deployment, I decided to go with that for the deploy tasks. I wondered if I could still use the deployment task from the previous version as described in the deployment guide for version 10g.
To test it, I deployed the ADF BC application to an ear file in JDeveloper11gtp (I will get to build tools later in this blog), and ran the following ant task:
<target name="deploy" depends="init" >
<oracle :deploy userid="${oc4j.admin.user}"
password="${oc4j.admin.password}"
file="${deploy.dir}/${ear.file}"
deploymentname="${app.name}-ear"
logfile="${log.dir}/deploy-ear.log"/>
<oracle :bindWebApp
userid="${oc4j.admin.user}"
password="${oc4j.admin.password}"
deploymentname="${app.name}-ear" webmodule="${app.name}-webapp"
websitename="${oc4j.binding.module}"
contextroot="/${app.name}" />
</target>
It works fine. The nice thing about JDeveloper11g is that the resources are project specific. This means that now the deployment profile for an ear file, will only take the connection that you need for this application. Not every connection that you have ever stored in the IDE.
Still, I don’t like to use the deployment profiles from JDeveloper. Managing the dependencies that are needed for your application(s) is really difficult. This gets worse if you have several different projects and workspaces. If want to do continuous integration you need ant or maven, or some other tool.
Ant soon becomes unmanageable when you have several artifacts and a lot of libraries. I had good experiences with Maven in the past, so I decided to have a go with Maven2.
There is a very nice post by Aino Andriesen on the Amis weblog. Unfortunately, the libraries that ADF uses have changed. This means you need to do some work to get them all listed in your pom.
- create a directory structure as described by Aino
- create an ant build file based on the project in JDeveloper. This will point you to all the jar files that are used by the webapplication. You don’t need to package all these files, these are the standard libraries needed to compile any ADF BC application
- add the jar files that end up in the ear file generated by JDeveloper deployment profiles as dependencies to the pom
- add the jar files to your local repository. You can use the following command for that:
mvn install:install-file -Dfile=[path-to-file] -DgroupId=[group-id] -DartifactId=[artifact-id] -Dversion=[version] -Dpackaging=jar - add the ant deployment task with Antrun plugin
You are done. If anyone is interested in getting the pom, just leave a comment and I will send it to you. All in all not so painful after all!
Comments: (1)
Blogs
- 26 Jul
- 10 Jun
- 02 Jun
- 26 Mar
- 25 Feb
-
05 Nov
Some tips & tricks on migrating SOA Suite 10g to 11g – Part 2
- 04 Nov
- 02 Nov
- 25 Oct
- 20 Oct
- Best practices 2 - Web Services
- Fault handling in Oracle SOA Suite 11g - Part II
- Fault handling in Oracle SOA Suite 11g
- Migrating Web Services from JDeveloper 10g to 11g
- Migrating EJB 3 applications from OC4J to WebLogic
- Best practices for BPM, SOA and EDA
- Some tips & tricks on migrating SOA Suite 10g to 11g - Part 2
- Logging messages in Oracle SOA Suite 11g using OWSM
Loading ...
I’m interested in the pom file, trying to do something similar. You’ll get to know about …