Create a deployment package using the command line

You can use the command line to create a deployment package (DAR file) that can be imported into Deploy. This example packages an application called PetClinic that consists of an EAR file and a resource specification.

  1. Create a directory to hold the package contents:

    mkdir petclinic-package
  2. Collect the EAR file and the configuration directory. Store them in the directory:

    cp /some/path/petclinic-1.0.ear petclinic-package
    cp -r /some/path/conf petclinic-package
  3. Create a deployit-manifest.xml file that describes the contents of the package:

    <?xml version="1.0" encoding="UTF-8"?>
    <udm.DeploymentPackage version="1.0" application="PetClinic">
      <deployables>
      ...
      </deployables>
    </udm.DeploymentPackage>
    1. Add the EAR file and the configuration folder to the manifest:

      <jee.Ear name="/PetClinic-Ear" file="/petclinic-1.0.ear" />
      <file.Folder name="PetClinic-Config" file="conf" />
    2. Add the datasource to the manifest:

      <was.OracleDatasourceSpec name="PetClinic-ds">
        <driver>com.mysql.jdbc.Driver</driver>
        <url>jdbc:mysql://localhost/petclinic</url>
        <username>{{DB_USERNAME}}</username>
        <password>{{DB_PASSWORD}}</password>
      </was.OracleDatasourceSpec>

      Note: The datasource uses placeholders for the user name and password. For more information, see Using placeholders in Deploy.

      The complete manifest file looks like:

      <?xml version="1.0" encoding="UTF-8"?>
        <udm.DeploymentPackage version="1.0" application="PetClinic">
          <deployables>
            <jee.Ear name="/PetClinic-Ear" file="/petclinic-1.0.ear" />
            <file.Folder name="PetClinic-Config" file="conf" />
            <was.OracleDatasourceSpec name="PetClinic-ds">
              <driver>com.mysql.jdbc.Driver</driver>
              <url>jdbc:mysql://localhost/petclinic</url>
              <username>{{DB_USERNAME}}</username>
              <password>{{DB_PASSWORD}}</password>
            </was.OracleDatasourceSpec>
          </deployables>
        </udm.DeploymentPackage>
  4. Save the manifest file in the package directory.
  5. Create the DAR file:

    cd petclinic-package
    jar cf petclinic-1.0.dar *
  6. Log in to Deploy and follow the instructions described in import a package.