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}
    <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.1</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>petclinic-backend</name>
                                <type>jee.War</type>
                                <groupId>com.xebialabs.deployit.demo.petclinic-war</groupId>
                                <artifactId>PetClinic-Backend</artifactId>
                            </deployable>
    
                            <deployable>
                                <type>file.Archive</type>
                                <groupId>mysql</groupId>
                                <artifactId>mysql-connector-java</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>sampleWithListAndMaps</name>
                                <type>sample.ListAndMapsSpec</type>
                                <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>
            <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>package2</classifier>      <!-- you can use a classifier here -->
                <scope>provided</scope>
            </dependency>
        </dependencies>
    
    
    </project>