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

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

Step 1 Identify the application by its GAV definition

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


For example, for the sample application, the GAV definition is:


Step 2 Create and deploy the application

Next, create the application in the XL Deploy repository. You can use a jee.War configuration item (CI) to represent the application artifact; however, instead of uploading the artifact to XL Deploy, you can refer to its location in the external repository. Then, you can deploy the application to an environment by executing the following 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: This example assumes that the Environments/Dev/TEST environment already exists and contains the appropriate infrastructure items (such as a Tomcat virtual host or a JBoss Domain). For information about using the CLI to create infrastructure items and environments, refer to Work with configuration items in the XL Deploy CLI.

Using a Python file

Alternatively, you can put 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')
myApp1_0 = factory.configurationItem('Applications/myApp/1.0', 'udm.DeploymentPackage')
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.