30 March 2011

ojdeploy : Deploying ADF application from Command Line


Applications or modules can be deployed from JDeveloper without actually starting the JDeveloper IDE itself. Deploying from the command line, using ojdeploy, is especially useful where you need to deploy existing projects or applications using a batch file or other script.

Command Usage

ojdeploy -profile -workspace [ -project ] [ ]
ojdeploy -buildfile [ ]
ojdeploy -buildfileschema


Arguments: 
(Argument: Description)
  • profile: Name of the profile to deploy.
  • workspace: Full path to the JDeveloper workspace file (.jws).
  • project: Name of the JDeveloper project within the .jws where the deployment profile can be found. If omitted, the Profile is assumed to be in the workspace.
  • buildfile: Full path to a build file for batch deploy.
  • buildfileschema: Print XML Schema for the build file.


Note: Deployment profiles can be classified into two broad categories, those that are defined at the application or workspace level, and those defined at the project level. To deploy a workspace-profile, ojdeploy takes the workspace location, and the name of the profile. To deploy a project-profile it takes an additional -project argument.

Options
( -Option: Description)
  • -basedir: Interpret path for workspace relative to a base directory. The built-in macro ${base.dir} captures the value of -basedir.
  • -outputfile: Specifies an alternate location for the output. The default is within a \deploy directory inside the project or workspace. If this parameter does not specify a file extension, the extension is determined from the original file name in the deployment profile.
  • -nocompile: Prevents the build system from being invoked. This is useful if a workspace or project just needs to be packaged, and not compiled at this time. 
  • -clean: Deletes all files from the project output directory before compiling. Deployment will stop for that profile, if a file or directory could not be deleted.
  • -nodatasources: For Java EE applications, this prevents the weblogic-jdbc.xml file from being updated with connection information found in the JDeveloper IDE. This option is ignored for non-Java EE applications. More
  • -forcerewrite: Ensures output file is rewritten even if the contents have not changed in this run of ojdeploy.
  • -updatewebxmlejbrefs: Update EJB references in web.xml.
  • -define: Allows for additional macros to be defined on the command-line. This can also be done in an XML build file using the element. Macros and options defined on the command line supplement, or override, those found in the section of a build file if one is being used.
  • -statuslogfile: Full path to an output file for status summary. No macros allowed. The -statuslogfile option will create an XML file that stores a list of all the profiles processed and the status of each. A summary section at the end can be checked to quickly determine the exit status for the entire script.

Built-in Macros
(Macro: Description)
  • workspace.name: Name of the workspace (without the .jws extension).
  • workspace.dir: Directory of the workspace.jws file.
  • project.name: Name of the project (without the .jpr extension).
  • project.dir: Directory of the project.jpr file.
  • profile.name: Name of the profile being deployed.
  • deploy.dir: Default deploy directory for the profile.

Note: The project.name and project.dir macros are only available when a project-level profile is being deployed.

Examples

Deploy a project-level profile: 
  • ojdeploy -profile webapp1 -workspace /usr/jdoe/Application1/Application1.jws -project Project1 
  • ojdeploy -profile webapp1 -workspace Application1/Application1.jws -basedir /usr/jdoe -project Project1
Deploy a workspace-level profile: 
  • ojdeploy -profile earprofile1 -workspace /usr/jdoe/Application1/Application1.jws

Deploy all profiles from all projects of a workspace: 
  • ojdeploy -workspace /usr/jdoe/Application1/Application1.jws -project \* -profile \*

Build in batch mode from a ojbuild file: 
  • ojdeploy -buildfile /usr/jdoe/ojbuild.xml

Build using ojbuild file, pass into, or override default variables in, the build file: 
  • ojdeploy -buildfile /usr/jdoe/ojbuild.xml -define myhome=/usr/jdoe,mytmp=/tmp 
  • ojdeploy -buildfile /usr/jdoe/ojbuild.xml -basedir /usr/jdoe

Build using ojbuild file, set or override parameters in the default section: 
  • ojdeploy -buildfile /usr/jdoe/ojbuild.xml -nocompile ojdeploy -buildfile /usr/jdoe/ojbuild.xml -outputfile '${workspace.dir}/${profile.name}.jar' 
  • ojdeploy -buildfile /usr/jdoe/ojbuild.xml -define mydir=/tmp -outputfile '${mydir}/${workspace.name}-${profile.name}'

More examples
  •  ojdeploy -workspace Application1/Application1.jws,Application2/Application2.jws -basedir /home/jdoe -profile app* 
  • ojdeploy -buildfile /usr/jdoe/ojbuild.xml -define outdir=/tmp,rel=11.1.1 -outputfile '${outdir}/built/${workspace.name}/${rel}/${profile.name}.jar' 
  • ojdeploy -workspace Application1/Application1.jws -basedir /home/jdoe -nocompile -outputfile '${base.dir}/${workspace.name}-${profile.name}'
Quick Overrides Without Editing a Build Script

To pass in macro values or override the ones defined in a build script, use the -define option to supply a new value: 
  • ojdeploy -buildfile /home/user/ojbuild.xml -define "mycustomdir=/tmp"

This will add the mycustomdir variable to the section of the build script, or replace it if it already is defined with the value '/tmp'.

To pass in parameter values or override the ones defined in a build script, use the appropriate parameter option: 
  • ojdeploy -buildfile /home/user/ojbuild.xml -nocompile -nodatasources

This will add the -nocompile and -nodatasources parameters to the default section of the build file.

See related posts (when they arrive) for more info.

Src: 
  • JDeveloper's Help or ojdeploy commands help switch.  I did not manage to find it online :( 

No comments:

Post a Comment

You might also like:

Related Posts Plugin for WordPress, Blogger...
There was an error in this gadget