Deploy externally-stored artifacts

This topic describes how to use the Deploy command-line interface (CLI) to deploy an artifact from a Maven repository such as Artifactory or Nexus. This tutorial uses this sample application. This is a WAR file that you can deploy to middleware such as Apache Tomcat or JBoss AS/WildFly.

Tip: For more information about configuring Deploy to work with Maven, see Configure Deploy to fetch artifacts from a Maven repository.

Step 1 Identify the application by its GAV definition

In Artifactory or Nexus, identify the application by its GAV definition in the following format:


For the sample application, the GAV definition is:


Step 2 Create and deploy the application

Create the application in the Deploy repository. You can use a jee.War configuration item (CI) to represent the application artifact. Refer to the artifact location in the external repository. To deploy the application to an environment, execute these commands:

admin > myApp = factory.configurationItem('Applications/myApp', 'udm.Application')
admin > repository.create(myApp) PyInstance: Applications/myApp
admin > myApp1_0 = factory.configurationItem('Applications/myApp/1.0', 'udm.DeploymentPackage')
admin > repository.create(myApp1_0) PyInstance: Applications/myApp/1.0
admin > myFile = factory.configurationItem('Applications/myApp/1.0/demo','jee.War', {'fileUri': 'maven:io.brooklyn.example:brooklyn-example-hello-world-webapp:war:0.7.0-M1'})
admin > repository.create(myFile)
PyInstance: Applications/myApp/1.0/demo
admin > package ='Applications/myApp/1.0')
admin > environment ='Environments/Dev/TEST')
admin > deploymentRef = deployment.prepareInitial(,
admin > depl = deployment.prepareAutoDeployeds(deploymentRef)
admin > task = deployment.createDeployTask(depl)
admin > deployit.startTaskAndWait(

Note: In this example the Environments/Dev/TEST environment already exists and contains the appropriate infrastructure items, such as a Tomcat virtual host or a JBoss Domain. For more information about using the CLI to create infrastructure items and environments, see Work with configuration items in the Deploy CLI.

Using a Python file

You can add the commands in a Python script and execute the script from the CLI. This allows you to modularize the code and pass in variables. For example:

myApp = factory.configurationItem('Applications/myApp', 'udm.Application') repository.create(myApp)
myApp1_0 = factory.configurationItem('Applications/myApp/1.0', 'udm.DeploymentPackage') repository.create(myApp1_0)
myFile = factory.configurationItem('Applications/myApp/1.0/demo','jee.War',{'fileUri':'maven:io.brooklyn.example:brooklyn-example-hello-world-webapp:war:0.7.0-M1'})
package ='Applications/myApp/1.0')
environment ='Environments/Dev/TEST')
depl = deployment.prepareInitial(,
depl2 = deployment.prepareAutoDeployeds(depl)
task = deployment.createDeployTask(depl)

Tip: Use the -f option to run the CLI with a Python file.

Step 3 Verify the deployment

If you deployed the application to a Tomcat or JBoss instance running on local port 8080, you can verify the deployed application at http://localhost:8080/demo.