Modify the Maven build command for Git commit triggered builds on Open Shift

The Open Shift standard Maven build command is mvn clean package -Popenshift -DskipTests.

Developing my tennis club admin tool (Smash), I used Arquillian for the integration testing. Following best practices principle that says that yoou should be able to clone a project to your hard drive, issue mvn clean install and it should work, the default Arquillian profile is to run my Wildfly instances managed. This means that Maven downloads a Wildfly distribution for every module of the project.

Building Smash straight off didn├Ąt work since the project consists of twenty modules and the download of Wildfly dists depleted the disc space during build.

On my home site I build the entire deployment issuing mvn clean install -DskipTests -Parq-wildfly-remote. This, of course, skips testing. Arquillian still downloads the Wildfly dist unless I activate the arq-wildfly-remote profile, and I needed to do this on OPen Shift as well.

The sollutio to modify the Maven build command is found in the .openshift directory of the Git repository. Inside there is the file .openshift/action_hooks/pre_build_wildfly. This contains the MAVEN_ARGS environment variable that sets the goals and options of triggered builds.

I changed the file, accordingly to

export MAVEN_ARGS="clean package -Popenshift,arq-wildfly-remote -DskipTests"

Which solved my problem.

Leave a comment