If you have not followed Part 1, please go back & follow steps to install & configure Hudson CI on your machine.
Assuming now you have configured Hudson server. Lets see how you generate ojdeploy build script for your application. I will take example of SRDemo application & also show you example of how you handle third party library dependency resolution.
Creating build script for ADF project
While the workspace is open, click on New, then choose Ant->Application Build File. This will ask for location & make sure you check option: “Include Packaging Tasks (uses ojdeploy)”
Modify the properties file to include your Jdev installation directory.
For example, my build & properties files would like below:
build.properties:
build.xml:
If you notice, in above build.properties file I'm using the build parameters I set in Part 1.
If you application have third party library references, you can replace them using replace commands. You can specify additional parameter in your hudson job to refer to location of third party libraries. Refer to build.xml target "replace-library-references"
So before you package your application ear, you will replace library references & then build the ear. Now lets see how you will configure hudson job.
If you notice the last Ant task where we specify the relative path of build.xml file and the most important order of targets to run from the build file, "deploy-all", "uninstall" and finally "install". This will run all the targets & create required application artifacts in specified DEPLOY_LOCATION path.
Notice I also used MANIFEST_BUILD_VERSION parameter for building & deploying different implementation version of shared library/application.
For this you need to create a MANIFEST.MF file at location:
SRDemoUI/src/META-INF/ MANIFEST.MF
Running the build script locally from Jdeveloper:
You can also run the build script locally for testing the application. You need to change below parameters in order to make it work.
- Before line basedir=${WORKSPACE}, add one more line on top to define WORKSPACE = <<your application workspace location>>. For e.g c:\mywork\SRDemo
- Specify your middleware home location by adding line JDEV_LOCATION = <<oracle middleware home location>>. For e.g c:\oracle\middleware1117
- Specify deploy location by adding line DEPLOY_LOCATION = <<deploy location>>. For e.g C:\DeployFolder
- Specify CODE_REVISION svn revision number you want to build
- Specify value for MANIFEST_BUILD_VERSION. You can leave it to default if you do not wish to update the implementation version of your deployed application.
Now right click the build.xml file from application resource navigator & select the target to run
.
Feel free to comment & let me know if you face any issues.