Open Source Consultant, Software Developer and System Administrator

If you are interrested in hiring a consultant for the effective use of open source software on an enterprise grade, take a look around in the About section to see, what I have to offer.

Blog and snippets

Various snippets or code parts I found useful, so I keep them here for reference.

Use FOP with grails

As there seem to be an error with the pom.xml for Apache FOP on maven central, just include the two offending avalon-framework packages beforehand (and we even use the newer versions, because org.apache.servicemix.bundles.fop does too).

dependencies {
    compile 'org.apache.avalon.framework:avalon-framework-api:4.3.1'
    compile 'org.apache.avalon.framework:avalon-framework-impl:4.3.1'
    compile('org.apache.xmlgraphics:fop:1.1') {
        excludes 'avalon-framework-api', 'avalon-framework-impl'
    }
}

Revised compilation of the SCSS for the war file (vaadin/grails)

Create or add scripts/_Events.groovy and include this. This now just takes all the Themes there (indicated by a styles.scss file there), compiles the styles.css and removes all the **/*.scss files from the target.

import com.vaadin.sass.internal.ScssStylesheet

eventCreateWarStart = { name, stagingDir ->
    new File("${stagingDir}/VAADIN/themes/").eachDir {
        def scssName = "${it}/styles.scss"
        if (new File(scssName).exists()) {
            ScssStylesheet scss = ScssStylesheet.get(scssName)
            scss.compile()
            def outFile = new File("$it/styles.css")
            outFile.write(scss.toString())
            ant.delete(dir:"${it}", includes: "**/*.scss", verbose: true)
        }
    }
}

Minimalistic Grails wrapper

Checks for the version in application.properties or uses the highest version (adjust BASE)

#!/bin/sh
BASE=~/apps
version=`ls -d "$BASE"/grails-* | tail -n1 | perl -ne 'print "$1" if (/-([0-9\.]+)$/)'`
if test -f "./application.properties"; then
      version=`cat ./application.properties | perl -ne 'print "$1" if (/app.grails.version=([0-9\.]+)$/)'`
fi
"$BASE"/grails-"$version"/bin/grails "$*"