Generate DAR

DAR - Deployit Archive - is a new Maven packaging type. It allows to generate a Deployit deployment package with all the necessary deployables (artifacts and middleware resources) that compose the application and to gather all into an archive (.dar) that could be installed in a Maven repository and later imported into Deployit. The following example describes a package that contains:

  • a war file - petclinic - defined as a maven dependency (groupId and artifactId, the version is defined in the dependency node)
  • a war file - petclinic-backend - defined as a maven dependency
  • an archive file - the driver jdbc mysql - defined as a maven dependency
  • a configuration folder - configuration - defined using a location, the location/ is relative to the dar project.
  • a package using a classifier
  • a weblogic datasource - petclinicDS - with common static properties (jndiNames, driverName ...) and environment based properties (username, password}
  • a 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.deployit</groupId>
        <artifactId>maven-deployit-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.deployit</groupId>
                    <artifactId>maven-deployit-plugin</artifactId>
                    <version>3.9.5</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.deployit</groupId>
    <artifactId>maven-deployit-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.deployit</groupId>
                <artifactId>maven-deployit-plugin</artifactId>
                <version>3.9.5</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.deployit</groupId>
                <artifactId>maven-deployit-plugin</artifactId>
                <version>3.9.5</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>