Generate an XL Deploy archive (DAR)

The XL Deploy archive (DAR) Maven packaging type allows you to generate an XL Deploy deployment package with the necessary deployables (artifacts and middleware resources) that compose the application and put them in an archive (.dar) that can be installed in a Maven repository and later imported into XL Deploy. This sample describes a package that contains:

  • WAR file petclinic: Defined as a Maven dependency (groupId and artifactId, the version is defined in the dependency node)
  • WAR file petclinic-backend: Defined as a Maven dependency
  • Archive file, the driver jdbc mysql: Defined as a Maven dependency
  • Configuration folder called configuration: Defined using a location, the location/ is relative to the DAR project
  • Package using a classifier
  • WebLogic datasource petclinicDS: With common static properties (jndiNames, driverName ...) and environment-based properties (username, password}
  • Sample type that has all possible property kinds
    <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/maven-v4_0_0.xsd">
    
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.xebialabs.xldeploy</groupId>
        <artifactId>xldeploy-maven-plugin-dar-format</artifactId>
    
        <packaging>dar</packaging> <!-- DAR packaging -->
    
        <version>1.0</version>
        <name>Dar Format</name>
        <url>http://www.xebialabs.com</url>
        <build>
            <plugins>
                <plugin>
                    <groupId>com.xebialabs.xldeploy</groupId>
                    <artifactId>xldeploy-maven-plugin</artifactId>
                    <version>5.0.3-SNAPSHOT</version>
    
                    <extensions>true</extensions> <!-- tells maven the plugin contains extensions -->
    
                    <configuration>
                        <deploymentPackageProperties>
                            <!-- Enter any deployment package level properties as <property>value</property> -->
                            <orchestrator>default</orchestrator>
                            <satisfiesReleaseNotes>true</satisfiesReleaseNotes>
                        </deploymentPackageProperties>
                        <deployables>
    
                            <jee.War name="petclinic" groupId="com.xebialabs.deployit.demo.petclinic-war" artifactId="PetClinic"/>
    
                            <jee.War name="petclinic-backend" groupId="com.xebialabs.deployit.demo.petclinic-war" artifactId="PetClinic-Backend"/>
    
                            <file.Archive name="mysql-backend" groupId="mysql" artifactId="mysql-connector-java"/>
    
                            <file.Folder name="configurationFolder" location="config"/>
    
                            <file.Archive name="configuration" groupId="org.some.group" artifactId="your-artifact" classifier="txt"/>
    
                            <wls.DataSourceSpec name="petclinicDS">
                                <jndiNames>jndi/toto</jndiNames>
                                <driverName>com.mysql.jdbc.Driver</driverName>
                                <url>jdbc:mysql://localhost/petclinic</url>
                                <username>{{DB_USERNAME}}</username>
                                <password>{{DB_PASSWORD}}</password>
                            </wls.DataSourceSpec>
    
                            <sample.AllPossibleKindsSpec name="sampleWithAllPossibleKinds">
                                <someProp>propValue</someProp>
                                <someBoolean>true</someBoolean>
                                <myList>
                                    <value>val1</value>
                                    <value>val2</value>
                                </myList>
                                <myMap>
                                    <entry key="key">value</entry>
                                    <entry key="foo">bar</entry>
                                </myMap>
                                <myEmbedded>
                                    <sample.EmbeddedCi name="MyEmbeddedCi">
                                        <someProp>propValue</someProp>
                                    </sample.EmbeddedCi>
                                </myEmbedded>
                                <myCiRef ref="petClinicDs"/>
                                <myCiRefs>
                                    <ci ref="petclinic-backend"/>
                                    <ci ref="mysql-backend"/>
                                </myCiRefs>
                            </sample.AllPossibleKindsSpec>
    
                       </deployables>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    
        <dependencies>
            <dependency>
                <groupId>com.xebialabs.deployit.demo.petclinic-war</groupId>
                <artifactId>PetClinic</artifactId>
                <version>1.0</version>
                <type>war</type>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>com.xebialabs.deployit.demo.petclinic-war</groupId>
                <artifactId>PetClinic-Backend</artifactId>
                <version>1.0-SNAPSHOT</version>
                <type>war</type>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>5.1.13</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.some.group</groupId>
                <artifactId>your-artifact</artifactId>
                <version>1.0</version>
                <classifier>txt</classifier>      <!-- you can use a classifier here -->
                <scope>provided</scope>
            </dependency>
        </dependencies>
    
    
    </project>
    

Example using deployables that share same artifactId and groupId but differ by type or classifier

<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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.xebialabs.xldeploy</groupId>
    <artifactId>xldeploy-maven-plugin-dar-format</artifactId>

    <packaging>dar</packaging> <!-- DAR packaging -->

    <version>1.0</version>
    <name>Dar Format</name>
    <url>http://www.xebialabs.com</url>
    <build>
        <plugins>
            <plugin>
                <groupId>com.xebialabs.xldeploy</groupId>
                <artifactId>xldeploy-maven-plugin</artifactId>
                <version>5.0.3-SNAPSHOT</version>

                <extensions>true</extensions> <!-- tells maven the plugin contains extensions -->

                <configuration>
                    <deploymentPackageProperties>
                        <!-- Enter any deployment package level properties as <property>value</property> -->
                        <orchestrator>default</orchestrator>
                        <satisfiesReleaseNotes>true</satisfiesReleaseNotes>
                    </deploymentPackageProperties>
                    <deployables>

                        <!-- artifactType will match type of artifact specified in dependancies-->
                        <jee.War name="petclinic-war" groupId="com.xebialabs.deployit.demo.petclinic" artifactId="PetClinic" artifactType="war"/>

                        <jee.Ear name="petclinic-ear" groupId="com.xebialabs.deployit.demo.petclinic" artifactId="PetClinic" artifactType="ear"/>

                    </deployables>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>com.xebialabs.deployit.demo.petclinic</groupId>
            <artifactId>PetClinic</artifactId>
            <version>1.0</version>
            <type>war</type><!-- Type can be used to destingiush between artifacts.-->
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.xebialabs.deployit.demo.petclinic</groupId>
            <artifactId>PetClinic</artifactId>
            <version>1.0</version>
            <type>ear</type><!-- Type can be used to destingiush between artifacts -->
            <scope>provided</scope>
        </dependency>
    </dependencies>
</project>

Example using legacy format of deployables.

This format is still supported by the plugin.

<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/maven-v4_0_0.xsd">

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

                <extensions>true</extensions> <!-- tells maven the plugin contains extensions -->

                <configuration>
                    <deployables>

                        <deployable>
                            <name>petclinic</name>
                            <type>jee.War</type>
                            <groupId>com.xebialabs.deployit.demo.petclinic-war</groupId>
                            <artifactId>PetClinic</artifactId>
                        </deployable>

                        <deployable>
                            <name>configuration</name>
                            <type>file.Folder</type>
                            <location>config</location>
                        </deployable>

                        <deployable>
                            <name>aPackage2</name>
                            <groupId>org.some.group</groupId>
                            <artifactId>your-artifact</artifactId>
                            <classifier>package2</classifier>          <!-- you can use a classifier here -->
                            <type>file.Archive</type>
                        </deployable>

                        <deployable>
                            <name>petclinicDS</name>
                            <type>wls.DataSourceSpec</type>
                            <jndiNames>jndi/toto</jndiNames>
                            <driverName>com.mysql.jdbc.Driver</driverName>
                            <url>jdbc:mysql://localhost/petclinic</url>
                            <username>{{DB_USERNAME}}</username>
                            <password>{{DB_PASSWORD}}</password>
                        </deployable>

                        <deployable>
                            <name>sample.AllPossibleKinds</name>
                            <type>sample.AllPossibleKindsSpec</type>
                            <someProp>propValue</someProp>
                            <someBoolean>true</someBoolean>
                            <myList>
                                <list>
                                    <value>value1</value>
                                    <value>value2</value>
                                </list>
                            </myList>
                            <myMap>
                                <map>
                                    <key>value</key>
                                    <foo>bar</foo>
                                </map>
                            </myMap>
                        </deployable>

                    </deployables>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        ...
    </dependencies>


</project>