Skip to main content

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.

Run Springboot fatjar with Palantir Docker Gradle plugin

When creating Docker images for a Springboot project using the Palantir Docker plugin I found no easy way to pick up the fat jar from the bootRepackage task.

One way around this is to set each the jar and the bootRepackage tasks as dependencies. The jar tasks provides the output (which the Docker plugin will pick up) and the bootRepackage actually generates the proper file (with the same name).

docker {
    name "ofnir/app:${project.version}"
    dependsOn tasks.jar, tasks.bootRepackage
}

Provide a fixed name for the jar, so it's easier to refer from the Dockerfile:

jar {
    baseName = 'ofnir-app'
    version = null
    manifest {
        attributes 'Main-Class': mainClassName
    }
}

This will generate ofnir-app.jar.

Then a Dockerfile can be as simple as:

FROM java:8
EXPOSE 8080
COPY onfir-app.jar /usr/local/
WORKDIR /tmp
CMD ["java", "-jar", "/usr/local/onfir-app.jar"]

Add experimental theme reloading to VDecl

You can now also write themes on the fly in VDecl by just having it watch a directory where VAADIN/themes/<theme>/**/*.scss files are. Save a file matching this pattern and the theme with name <theme> will be set or reloaded for the current UI.

One challenge with this change was Vaadin not reloading the theme it does not have to. So changing the same theme over and over again would not show. For now I put a UI extension in place, drops the active theme via some native method. This results in the page showing no theme and then reloads the changed theme.

Use Vim-Fireplace with Figwheel greater 0.4

I have put together an example repo, how to use vim-fireplace with figwheel after the 0.4 release. This release removed cider and piggieback, so we have to add them back.

Add this to the according sections of your project.clj:

;; add nrepl middleware for fireplace
:figwheel {:nrepl-middleware ["cider.nrepl/cider-middleware"
                              "cemerick.piggieback/wrap-cljs-repl"]}
;; add piggieback for fireplace
:profiles {:dev {:dependencies  [[com.cemerick/piggieback "0.2.1"]]
                 :repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}}}