Deploy Java Archive

Octopus.JavaArchive exported 2026-07-22 by Octopus Deploy belongs to ‘Package’ category.

Deploy a Java archive (.jar, .ear, .war) to one or more machines.

Parameters

When this step is included in a project’s deployment process, the parameters below can be set.

Deploy the extracted package

Octopus.Action.JavaArchive.DeployExploded

If selected, the package will be deployed extracted rather than re-created as an archive.

Allowed values: True, False

Default: False

Compress the repacked archive

Octopus.Action.Package.JavaArchiveCompression

Whether the jar command will compress the items in the repackaged archive. Disabling compression is useful for some packages, like Spring Boot archives, that expect library files to be uncompressed.

Allowed values: True, False

Default: True

Deployed package file name

Octopus.Action.Package.CustomPackageFileName

The optional filename of the copied package. If left blank, the original filename from the feed will be retained.

Use custom deployment directory

Octopus.Action.Package.UseCustomInstallationDirectory

By default the package will be deployed to the target’s application directory. This option allows setting a custom deployment directory.

Allowed values: True, False

Default: False

Deploy Directory

Octopus.Action.Package.CustomInstallationDirectory

The installed package will be copied to this location on the remote machine.

Purge

Octopus.Action.Package.CustomInstallationDirectoryShouldBePurgedBeforeDeployment

Before the installed package is copied, all files in the custom installation directory will be removed.

Allowed values: True, False

Default: False

Exclude from purge

Octopus.Action.Package.CustomInstallationDirectoryPurgeExclusions

A newline-separated list of file or directory names, relative to the installation directory, to leave when it is purged. Extended wildcard syntax is supported.

Optional features

Enable features by adding their IDs to Octopus.Action.EnabledFeatures (a comma-separated list).

Custom Deployment Scripts Octopus.Features.CustomScripts

Execute scripts during the deployment (pre-deploy, deploy, post-deploy) without embedding them in your package.

Octopus.Action.CustomScripts.PreDeploy.

Octopus.Action.CustomScripts.PreDeploy.<ext>

Pre-deploy script body. The key’s is the script language extension: ps1 (PowerShell), sh (Bash), csx (C#), or py (Python).

Octopus.Action.CustomScripts.Deploy.

Octopus.Action.CustomScripts.Deploy.<ext>

Deploy-phase script body. The key’s is the script language extension: ps1 (PowerShell), sh (Bash), csx (C#), or py (Python).

Octopus.Action.CustomScripts.PostDeploy.

Octopus.Action.CustomScripts.PostDeploy.<ext>

Post-deploy script body. The key’s is the script language extension: ps1 (PowerShell), sh (Bash), csx (C#), or py (Python).

Structured Configuration Variables Octopus.Features.JsonConfigurationVariables

Replace settings in JSON, YAML, XML, and Java Properties files with Octopus variables. Enabled by default for package deployments.

Octopus.Action.Package.JsonConfigurationVariablesTargets

Octopus.Action.Package.JsonConfigurationVariablesTargets

Newline-separated list of target files (e.g. appsettings.json). Wildcards supported.

Substitute Variables in Templates Octopus.Features.SubstituteInFiles

Transforms files using the Octopus #{Variable} substitution syntax. Enabled by default for package deployments.

Octopus.Action.SubstituteInFiles.TargetFiles

Octopus.Action.SubstituteInFiles.TargetFiles

Newline-separated list of file names to transform (relative to package). Wildcards supported.

Octopus.Action.SubstituteInFiles.OutputEncoding

Octopus.Action.SubstituteInFiles.OutputEncoding

Encoding name for the output file (e.g. utf-8). Optional.

PowerShell Edition Octopus.Features.SelectPowerShellEditionForWindows

Specify the edition of PowerShell used during deployments on Windows.

Octopus.Action.PowerShell.Edition

Octopus.Action.PowerShell.Edition

PowerShell edition on Windows (Desktop or Core).

Allowed values: Desktop, Core

Step configuration using OCL

Example in Octopus Configuration Language (OCL):

step "deploy-java-archive" {
    name = "Deploy Java Archive"
    properties = {
        Octopus.Action.TargetRoles = "app-server"
    }

    action {
        action_type = "Octopus.JavaArchive"
        properties = {
            Octopus.Action.JavaArchive.DeployExploded = "False"
            Octopus.Action.Package.CustomInstallationDirectory = "/opt/myapp"
            Octopus.Action.Package.DownloadOnTentacle = "False"
            Octopus.Action.Package.FeedId = "octopus-server-built-in"
            Octopus.Action.Package.JavaArchiveCompression = "True"
            Octopus.Action.Package.PackageId = "MyApp"
            Octopus.Action.Package.UseCustomInstallationDirectory = "True"
            Octopus.Action.RunOnServer = "false"
        }

        packages {
            acquisition_location = "Server"
            feed = "octopus-server-built-in"
            package_id = "MyApp"
        }
    }
}

Page updated on Wednesday, July 22, 2026