Hibernate OGM is not maintained anymore

Last year I have been giving an introduction to OGM and OpenShift at JUDCon London using a modified version of the kitchensink quickstart. Time has gone and it was time to give the demo a revamp.

Thanks to Sanne the code got updated to use the latest app server (AS 7.1.1.Final Brontes) and naturally the latest OGM and Search versions. Another change is that now Infinispan is not only used to persist the entity data via OGM, but it is also used for storing the Lucene indexes via the Infinispan directory provider (see persistence.xml of the example project). Sanne added also a bunch of new tests show casing Arquillian and different ways to bundle the application. Definitely worth checking out!

Personally, I had a look at the project setup and made some changes there. The original demo assumed you had a local app server installation as a prerequisite on your machine. It then used the jboss-as-maven-plugin to deploy the webapp. Unfortunately, this plugin does not allow me to start and stop the server and it seems redundant to require a local install if the Arquillian tests already download an AS instance (yes, I could run the test against the local instance as well, but think for example continuous integration where I want to manage/control the WHOLE ENVIRONMENT).

In the end I decided to give the cargo plugin another go. A lot has happened there and it supports not only JBoss 7.x, but it also offers a so called artifact installer which allows to download the app server as a managed maven dependency. The relevant pom.xml settings look like this:

          ...
          <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <version>1.2.1</version>
                <configuration>
                    <container>
                        <containerId>jboss71x</containerId>
                        <artifactInstaller>
                            <groupId>org.jboss.as</groupId>
                            <artifactId>jboss-as-dist</artifactId>
                            <version>7.1.1.Final</version>
                        </artifactInstaller>
                    </container>
                </configuration>
                <executions>
                    <execution>
                        <id>install-container</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>install</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.gmaven</groupId>
                <artifactId>gmaven-plugin</artifactId>
                <version>1.3</version>
                <executions>
                    <execution>
                        <id>copy-modules</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                        <configuration>
                            <source>
                                def toDir = new File(project.properties['jbossTargetDir'], 'modules')
                                def fromDir = new File(project.basedir, '.openshift/config/modules')
                                log.info('Copying OGM module from ' + fromDir + ' to ' + toDir)
                                ant.copy(todir: toDir) {
                                fileset(dir: fromDir) {
                                exclude(name: 'README')
                                }
                                }
                            </source>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            ...|
 

I am using cargo:install in the initialize phase to install the app server into the target directory. This way I can install a custom module (via the gmaven plugin) before the tests get executed and/or before I start the application via a simple:

    $ mvn package cargo:run

Neat, right?

You find all the code on GitHub in the ogm-kitchensink. The README gives more information about the main maven goals.

Enjoy, Hardy


Back to top