JDev – Ant build file tweak required for ojdeploy option

JDeveloper assists developers in generating a preconfigured Ant build script for each project within a JDeveloper application. Of particular interest in JDeveloper 11g an option is included to generate entries for ojdeploy.

The options to do this are invoked by a right click on the project at hand, New -> All Technologies -> General -> Ant -> Buidfile form Project. This will present the following dialog:


...including selecting the option "Include Packaging Tasks (uses ojdeploy)".

Within the generated build.xml script the result of this checkbox is the additional Ant target "deploy", as demonstrated in the following code sample:
















classpath="${oracle.jdeveloper.ant.library}"/>
ora:buildscript="${oracle.jdeveloper.deploy.dir}/ojdeploy-build.xml"
ora:statuslog="${oracle.jdeveloper.deploy.dir}/ojdeploy-statuslog.xml">










deprecation="${javac.deprecation}" encoding="Cp1252" source="1.6" target="1.6">































(Oops, there appears to be a bug in the SyntaxHighlighter viewer above in that it's displaying lots of close tags at line 63, just ignore them).

However there's an issue in the generated build.xml script with the ojdeploy option. The injected "deploy" target is not just dependent on the "init" and "compile" targets, but is also dependent on the output of the "copy" target below. As such modify the "deploy" target to as follows:

If you don't include this dependency, when ojdeploy generates a resulting JAR, WAR or EAR, it can fail to include all the file types listed under the "copy" target including XML files and more. As an example where this would be a problem, is if you're deploying a Common ADF Model library via the generated build.xml script with the ojdeploy option, while the resulting Java archive will include the compiled dot-class files, the XML files that constitute the Business Components would be missing in the end product making it unusable.

Verified under JDeveloper 11.1.1.2.0 build 5536 and JDeveloper 11.1.1.3.0 build 5660.
© 2008 SYS-CON Media