NaturalONE Version 8.3.7
 —  Using NaturalONE  —

Deploying Java Applications

This document covers the following topics:


General Information

You can deploy a Java application in a way similar to deploying a Natural application. Prerequisites:

The purpose of the NaturalONE Java deployment is not the generation of some build script for Java projects. This has to be done separately, with other tools (such as Eclipse). The purpose of the NaturalONE Java deployment is to add some base functionality, such as versioning repository access, and to make use of the already existing build scripts.

Top of page

Using the Deployment Wizard for Java Applications

The deployment wizard creates a Java deployment file in your project root. This is an Ant script. You can create one or more Java deployment files for a project, and you can also load an existing Java deployment file and modify the current settings.

Start of instruction setTo use the deployment wizard

  1. In the Navigator view or in the Natural Navigator view, select the Java project for which you want to create the deployment file.

    Or:
    If you want to load the settings of an existing Java deployment file, select this file in the Navigator view or in the Natural Navigator view.

  2. From the File menu or from the context menu, choose New > Other.

  3. In the resulting New dialog box, expand the Natural node, select Deploy Natural Java Ant and then choose the Next button.

    The first page of the wizard appears (see below).

  4. Specify all required information as described in the topics below. Use the Next button repeatedly to proceed from the first page of the wizard to the last page.

  5. When all required information has been provided, choose the Finish button.

The different pages of the deployment wizard are described in the following topics:

General Settings

On the first page of the wizard, you define general settings for the deployment.

Deploy

Deployment file

The default name for the Java deployment file is javadeploy.xml. This name is shown in this text box when an existing Java deployment file was not selected while invoking the wizard. However, when an existing Java deployment file was selected, the name of the selected file is shown and the settings from this file are automatically loaded.

You can enter any other name for your new deployment file. It is recommended that your new deployment file also has the extension ".xml".

Note:
If you keep the name javadeploy.xml, the settings from an existing Java deployment file with the same name are loaded the next time you select the project and invoke the wizard.

If you want to load an existing Java deployment file, choose the Browse button. A dialog appears, providing for selection all Java deployment files in the current project. Next, you have to choose the Load from File button. Otherwise, the settings in this file are not shown in the wizard and may thus be overwritten unintentionally.

If you want to return to the default settings of the deployment wizard (this also includes the information that can be specified on the other pages of the wizard), choose the Load Defaults button.

Enable password encryption

When enabled, all passwords that are used in the deployment file are stored in an encrypted format.

Enable fail-on-error for Ant script

When enabled, the Ant script reports errors and terminates in the case of a build failure.

When disabled, the Ant script still reports errors but build failures are only triggered in severe situations (see also Status Code Handling).

Root directory

This path should only be changed when you intend to start the deployment from the command line (that is, when the deployment is not to be started from Eclipse).

Specify the directory in which the selected project is to be checked out and where the processing takes place. When the deployment is supposed to run on a different machine, you can insert the desired root path via copy-and-paste.

Java build file

Specify the name of the Ant build file that is to be used for the deployment of the selected Java project. This build script must have been generated with some other tool in advance. You can also choose the Browse button to select the build file from a dialog box; in this case, all existing build files in the current Java project are provided for selection.

Repository

On the second page of the wizard, you define all settings related to the versioning repository. This can be either Subversion (SVN), GIT or CVS.

Deploy

From the Type drop-down list box, select the type of versioning repository that you are using, and then specify all required information. The names of the text boxes and their availability changes according to the selected type.

The wizard usually collects a set of default information as given for the selected project. In most cases, only minor corrections have to be made to the defaults, for example, user ID and password may have to be provided.

Top of page

Starting the Deployment from Eclipse

When you start the deployment process from Eclipse, it is not possible to execute the checkout and update targets of the deployment file since these targets would access the versioning repository, and this is not feasible from within an Eclipse environment. If you want to check out a specific revision from the versioning repository or if you want to update your project with sources from the versioning repository, you have to start the deployment from the command line as described below.

For testing purposes, for example, it is helpful to start the deployment process from Eclipse. Since the Java deployment file is an Ant script, the built-in Eclipse functionality of starting Ant scripts is used here. The build target of the Ant script will then be executed.

Start of instruction setTo start the deployment from Eclipse

Top of page

Starting the Deployment from the Command Line

You can start the deployment process from a Windows command line such as the Command Prompt (cmd.exe) or from a shell command line on a Linux system. When you start the deployment from the command line, special requirements must be met.

The following topics are covered below:

Prerequisites

The prerequisites for deploying a Java application are the same as for deploying Natural applications. See Prerequisites in Deploying Natural Applications. However, you have to copy the Java deployment file to the root directory (instead of the Natural deployment file).

In addition, all necessary tools which are referred to in the Ant build file (specified on the first page of the wizard) must be available and accessible on the processing platform.

Starting the Deployment

When all prerequisites are in place, the deployment can be started by issuing specific Ant calls. This section just provides some examples (where the default name javadeploy.xml is used).

Top of page

Status Code Handling

The Ant deployment script for Java can run in two status code modes. The mode can be toggled by specifying the command line parameter -Dnatural.ant.java.failonerror as described in the following table.

Command Line Option Description
-Dnatural.ant.java.failonerror=no Only severe errors such as missing project directories will lead to a build failure with a status code other than 0. This is the default mode.
-Dnatural.ant.java.failonerror=yes In addition to the severe errors described above, errors occurring during checkout or update will also lead to a status code other than 0 and hence will lead to a build failure.

Note:
The default mode can also be changed on the first page of the deployment wizard.

When the additional status code handling has been enabled, the Ant tool as well as the internally used tools such as SVN, GIT or CVS clients may issue specific status codes. In case the status codes are unclear, refer to the documentation of these tools.

Top of page