Dump entries to LDIF file

The following example demonstrates how to use the LDAP Maven Plugin to dump directory contents to LDIF format after integration tests have been performed.

  • LDAP Directory Server

    In this example we are assuming that Apache Directory Server is being used and is installed locally on port 10389 with the default admininstration account (uid=admin,ou=system) and password (secret). Furthermore, we are assuming that the base DN has not been modified from the default (o=sevenSeas).

  • Configure a POM

    Add the following configuration to your project POM to dump the data after test execution:

    <project>
      <modelVersion>4.0.0</modelVersion>
      ...
      <build>
        <plugins>
          <plugin>
            <groupId>com.btmatthews</groupId>
            <artifactId>ldap-maven-plugin</artifactId>
            <executions>
              <execution>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>ldif-dump</goal>
                </goals>
                <configuration>
                  <version>3</version>
                  <host>localhost</host>
                  <port>10389</port>
                  <authDn>uid=admin,ou=system</authDn>
                  <passwd>secret</passwd>
                  <filename>dump.ldif</filename>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </project>