How to use an external artifact reference

XL Deploy allows you to generate an XL Deploy deployment package with CIs that refer to artifacts in an external store (that is, in a Maven repository or JCR repository). This sample describes a package that contains a WAR file called petclinic that is defined in an external Maven repository.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.xebialabs.maven.demo</groupId>
    <artifactId>depl-7621</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>pom</packaging>

    <properties>
        <deployit.username>admin</deployit.username>
        <deployit.password>admin</deployit.password>
        <deployit.server>localhost</deployit.server>
        <deployit.port>4516</deployit.port>
        <deployit.container>Environments/was85nd</deployit.container>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>com.xebialabs.xldeploy</groupId>
                <artifactId>xldeploy-maven-plugin</artifactId>
                <version>5.0.0-SNAPSHOT</version>
                <extensions>true</extensions>

                <configuration>
                    <username>${deployit.username}</username>
                    <password>${deployit.password}</password>
                    <serverAddress>${deployit.server}</serverAddress>
                    <port>${deployit.port}</port>
                    <deletePreviouslyDeployedDar>true</deletePreviouslyDeployedDar>
                    <timestampedVersion>false</timestampedVersion>
                    <cancelTaskOnError>false</cancelTaskOnError>
                    <deployables>
                        <was.War name="petclinic-war">
                            <contextRoot>petclinic</contextRoot>
                            <fileUri>maven:com.xebialabs.deployit.demo.petclinic:PetClinic:war:1.0</fileUri>
                             <tags>
                                <value>server1</value>
                             </tags>
                        </was.War>
                    </deployables>
                    <environmentId>${deployit.container}</environmentId>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

Note that:

  • XL Deploy must be configured to have access to the Maven repository where artifacts are stored.
  • The Maven artifact with Maven GAV coordinates (com.xebialabs.deployit.demo.petclinic:PetClinic:war:1.0) must be present in a Maven repository configured in XL Deploy.
  • The generated deployment package will not contain the referenced artifacts; they are resolved by XL Deploy directly.