The LDAP Maven Plugin is a Maven plugin that can:

  • Import/export data to/from a LDAP directory server. Both the LDIF and DSML formats are supported.
  • Launch and shutdown a LDAP directory server in the Maven build life-cycle. The plugin supports the following LDAP directory servers:

Importing or exporting data

The plugin provides the following goals to import or export content from a LDAP directory server:

  • load is used to load content from a file into a LDAP directory server.
  • dump is used to dump content to a file from a LDAP directory sever.

The following file formats are supported:

  • LDIF – LDAP Directory Interchange Format
  • DSML – Directory Services Markup Language

LDAP Data Interchange Format (LDIF)

Import

The following POM fragment demonstrates how to load content into a LDAP directory server from a LDIF formatted file using the load goal of the LDAP Maven Plugin.

Export

The following POM fragment demonstrates how to export content from a LDAP directory server to a LDIF formatted file using the dump goal of the LDAP Maven Plugin.

Directory Service Markup Language (DSML)

Import

The following POM fragment demonstrates how to load content into a LDAP directory server from a DSML formatted file using the load goal of the LDAP Maven Plugin.

Export

The following POM fragment demonstrates how to export content from a LDAP directory server to a DSML formatted file using the dump goal of the LDAP Maven Plugin.

Running an LDAP Server in the build life-cycle

pom.xml

The following POM fragment uses the run goal to launch an embedded LDAP directory server prior to the execution of the integration tests and then uses the stop goal to shutdown the embedded LDAP directory server upon completion of the integration tests.

Connecting in Java

The following LDAP client libraries can be used to connect to the embedded LDAP server:

The LDAPUnit library provides an assortment of assertion and verification methods for use in unit and integration test cases.

Maven Central Coordinates

The LDAP Maven Plugin has been published in Maven Central at the following coordinates:

License & Source Code

The LDAP Maven Plugin is made available under the Apache License and the source code is hosted on GitHub at https://github.com/bmatthews68/ldap-maven-plugin.

On a recent project I had problems deploying a web application built on the Struts 2 MVCframework to a fresh WebSphere installation. I wasted a lot of time labouring under the incorrect assumption (for once) that the architectural changes I had introduced in the latest sprint were the cause of my troubles.

But it turned out to be an environmental issue. We were deploying Struts 2 as a servlet filter and out of the box WebSphere does not support HTTP requests that are served by a servlet filter. A custom property called com.ibm.ws.webcontainer.invokefilterscompatibilty must be set for the web container. I guess I should have just deployed straight to the UAT environment!

Here is the procedure for setting the com.ibm.ws.webcontainer.invokefilterscompatibility custom property:

  1. In the administrative console click Servers > Application Servers > server_name> Web Container Settings > Web Container.
  2. Under Additional Properties select Custom Properties.
  3. On the Custom Properties page, click New.
  4. On the settings page, enter com.ibm.ws.webcontainer.invokefilterscompatibility in the Name field and true in the Value field.
  5. Click Apply or OK.
  6. Click Save on the console task bar to save your configuration changes.
  7. Restart the server.

You can add Google Analytics to a site generated with the Maven Site Plugin as by adding a <googleAnalyticsAccountId/> element containing your Web Property ID.

The instructions below are based on Installing Maven 3 on Ubuntu 10.04 LTS Server from Luke Bourke. I am installing Maven 3.0.3 on Ubuntu 11.04 LTS Server with Oracle Java 6.

Download the Maven 3.0.3 binary distribution from your local mirror:

$ wget http://ftp.heanet.ie/mirrors/www.apache.org/dist/maven/binaries/apache-maven-3.0.3-bin.tar.gz

Uncompress the binary distribution and copy it to the /usr/local directory:

$ tar -zxf apache-maven-3.0.3-bin.tar.gz
$ sudo cp -R apache-maven-3.0.3 /usr/local

Create symbolic link in /usr/bin:

$ sudo ln -s /usr/local/apache-maven-3.0.3/bin/mvn /usr/bin/mvn

I came across this post that almost completely explains how to get Sun Java SE 6 installed on Ubuntu 10.04 (Lucid Lynx).

$ do apt-get install python-software-properties
$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
$ sudo apt-get update
$ sudo apt-get install sun-java6-jdk

The problem I had with the original post was that add-apt-repository was not available until I installed the python-software-properties package.

 

If you want to create an archive (.zip, .tar.gz, etc.) file as part of a Maven 2 build you need to use the Assembly Plug-in. Furthermore, if you want to install it into your local repository or deploy it to a remote repository you will need the assistance of the Builder Helper Plug-in.

But if you are building a multi-module project you need to do it properly or you can severely mess up your build. I’ve just spent the last 2 weeks going round in circles trying to figure out why we couldn’t build our project from the root project. In the end it turned out to be the fact that I was incorrectly using the assembly goal instead of the singlegoal. This was causing Maven to fork and try to build all the project dependencies again. To us it looked like our dependencies were not getting installed into the local repository and it was going out to get the last good snapshot build of the components from our remote repository which were 2 weeks out of date by this time.

Of course. Once I found the solution a little light bulb went off and I remembered I’d already seen this problem before. About two years ago in fact.

Here is a sample POM snippet that assumes an assembly descriptor with an id of bin and a format of .tar.gz:

I discovered the following Maven 2 plugins capabable of building JBoss Service ARchives (SARs).

The JBoss Maven Plugin is the better of the two because it will bundle the project dependencies into the generated SAR along with the compiled classes and resources. Whereas the Maven SAR plugin only bundles the compiled classes and resources.

The following POM extract demonstrates the usage of the JBoss Maven Plugin:

After jumping through a few hoops I managed to get Archvia 1.1.3 successfully deployed to JBoss 4.2.3.

Set the appserver.base and appserver.home properties by adding the following lines to $JBOSS_HOME/bin/run.sh and restart JBoss.

Now create data source deployment descriptors for the archiva and users databases and copy them to $JBOSS_HOME/server/default/deploy. I am using MySQL 5.1 to as my database server.

archiva-ds.xml

users-ds.xml

Add WEB-INF/jboss-web.xml to the .war file.

WEB-INF/jboss-web.xml

Remove the following from the WEB-INF/lib folder of apache-archiva-1.1.3.warbecause they will cause conflicts with:

  • commons-logging-api-1.1.jar
  • log4j-1.2.14.jar

Copy apache-archiva-1.1.3.war to $JBOSS_HOME/server/default/deploy.