Archive for the ‘maven’ Category

My favorite Free/Open Source Intellij Community plugins

July 28, 2016 Leave a comment

Continuous delivery using github, travis-ci and bintray

July 12, 2016 Leave a comment


Let’s say you work on a Java application and want to frequently make it available for download so that user’s can easily try the latest version.

Let’s say you work primarily on your laptop or personal computer using a Java IDE and commit code changes, but you don’t want to spend time manually building jars, packaging war or zip files, testing your application or uploading files to a website, etc.

Instead you want to have a fully automated process that compiles your source code, runs automated tests and other quality control mechanisms, builds your application and uploads the result to a public website.

But you don’t want to install any infrastructure for this and not run anything besides Java and your IDE on your own machine(s).

Basically you want to use developer-friendly reliable cloud services but you don’t want to pay a single cent.

All of this is possible, as long your code is Open Source:

  • Host your source code on github
  • Let travis-ci run vour build process
  • Let travis-ci upload the build result to bintray

For details, you can take a look at one of my github projects.

Relevant config files:

Soon I will probably add more detailed instructions to this blog post on how to set up the cloud services.

Categories: coding, git, java, maven Tags: , ,

JBoss Undertow is pulling me in … :o)

March 19, 2015 1 comment

I am very impressed as I am trying out the various code examples for Undertow, a kick-ass, light-weight yet powerful, ultra-easy-to-embed HTTP and Java Servlet engine.

One of my side projects requires an embeddable yet feature-complete Java HTTP engine with low memory footprint and a simple straightforward API. I dismissed Tomcat, briefly considered Jetty, found Winstone too old and unmaintained, simpleframework not well-enough documented, vert.x and netty a little too much for my purposes and/or too complicated, so that a few weeks ago I had actually started to clone and refactor NanoHttpd.

The NanoHttpd refactoring was a great learning experience, but it certainly felt like I was reinventing the wheel in the form of a cute and mobile but slightly rusty foldable unicycle. ;o) – no offense please, nanohttpd developers

Then I found out about Undertow. The author Stuart Douglas is now officially my hero. What an awesome job he is doing! The server meets all of the above mentioned requirements and is apparently also comparatively fast. No wonder it is the HTTP engine used by Wildfly, the new JBoss AS.

Anyway, if you want to try yourself, I’d go with version 1.1 final at this time, i.e. this in your Maven pom.xml:


I decided to pretty much ignore the documentation section of the website for now, as it is still for version 1.0 and the API has changed – improved, I guess – since then. It seems to me, that at this point the core code itself and the usage examples are the best documentation for version 1.1. Both are Maven modules of the undertow github project.

By the way, if you are wondering why the project has no issues section on github: The issue tracking is done in the JBoss Jira.

Build Java Maven github project on travis-ci

February 15, 2015 Leave a comment

I used to use Cloudbees’ buildhive for continuous builds of my Java/Maven based github projects. But buildhive currently does not offer JDK 8. So far that hasn’t been a problem, but I recently started using lambdas and default methods in interfaces and other Java 8 goodness. And now buildhive does not work for me anymore.

So I looked for alternatives and tried It was easy enough to set up a free account: You just authorize their service through your github login. Then all your projects will be listed on travis and you just click a switch to enable a build.

.travis.yml with FTP upload

To actually activate a build, you have to add a .travis.yml file at the root of your project.

The builds then happen automatically whenever you commit changes to github. This is the build list for one of my projects.

My build produces a distributable zip file, using Maven assembly plugin, that contains all the jars and start scripts of my application. I want to make the latest stable version of that zip file available for public download. With buildhive I used the permanent URL of the build artifact within the workspace of the last stable Jenkins build. But travis does not store anything after the build.

To make travis-ci build artifacts available, a deploy step is required. Many cloud storage systems are supported, but I opted for a custom deploy via FTP to my web space at

So to build my Java Maven project with JDK 8 and do the FTP upload of the zip artifact, I ended up with these lines:

language: java
jdk: oraclejdk8

  - secure: L2lr/F0gIvyVUl0nJ7w9saGV7wZkL6nO61IxilDY/76iTlnhrFXn5Q8vATGbiRYdDW/tG1kyDUbKaWSkYrpV2Agm4wV/KmMg2CWRiIcQPPqwSEENx/1UZ/dBnCQGcRkkYApu5ayjGnX3Srg3ty1zvdud/O8tiKtWkkBDipJSpfY=
  - secure: OekVM5ZyLGHpqurOUWJcq0kKBA78WKZdXaA9aylwrjjQFeVoZxyxeZTYbhLajN4Ggg4Th58QwjUHpwcgZlnsxx4heDo1wyHxXojJd0H1LWKXJwet82IXaFJbl+Yz/htr7uWSFTUF6Szx70cpMxlGe3qsIFlgViEo9UGhHHdrjdY=


The env – global – secure entries are the encrypted username and password for my FTP server. Details about the encryption steps are at the end of this blog post.

Artifact upload script

The .travis/ script performs the actual upload. The .travis directory is in the root of my github project. The script looks like this:

#! /bin/bash

local_file="$(ls $TRAVIS_BUILD_DIR/typepad-dist/target/*.zip | head -n 1)"

echo "Uploading $local_file to $target_url"
curl -u $FTP_USER:$FTP_PASSWORD -T "$local_file" "$target_url"

I am only interested in the latest zip and I want the URL to be permanent, that’s why the filename is hardcoded as

Build status and download links

Similar to buildhive, travis-ci provides nice build status icons that automatically show the current status of your build.

The README.adoc of my github project now contains these build status and download links:

== Build status

link=""][Download latest build]

If you are not used to this syntax: It is AsciiDoc, not the default Markdown format of github READMEs.

Encryption of FTP credentials

Travis supports encryption of environment variables. This makes sense, because you probably don’t want to expose your FTP username/password to the world.

To perform the encryption, a local travis command-line installation is required. On Debian it can be setup like this:

1) Install JRuby (but not Rails)
2) gem install travis
3) cd to local working copy of your project
4) travis encrypt FTP_USER=yourusername --add
5) travis encrypt FTP_PASSWORD=yourpassword --add

The --add tells the travis command to add the resulting config directly to the .travis.yml file in your project directory. That’s why you first need cd to the base dir of your project.

Jenkins Maven builds on OpenShift

September 21, 2014 3 comments

Short version: If you want proper Maven builds with Jenkins on OpenShift, please vote for change request JENKINS-19844.

Full story:

Today I installed Jenkins on my OpenShift account to use it as Maven release build server for some of my Java based github projects. I ran into various obstacles and partially misleading information.

Installing the Jenkins “cartridge” on the OpenShift web console was the easiest part.

Then I logged into my new Jenkins using the auto-generated “admin” login. I created a “New Item” to “Build a maven2/3 project”, i.e. a new Maven build job, and configured it: Selected “Git” SCM and pasted the github URL of the project I want to build.

At first all “Build Now” attempts failed silently, until I realized I had to go into “Manage Jenkins” – “Configure System” page to change the “# of executors” from 0 to 1.

Next thing was that the Maven installation was not found. I set up ssh access to my OpenShift Jenkins (paste contents of ~/.ssh/ from my Linux laptop into web console, then find the ssh hostname to connect) and ran a “find -name mvn /usr” on the host which located a Maven installation at /usr/share/java/apache-maven-3.0.4. I entered this in the “Maven installation” section on the Jenkins “Configure System” page.

Now I got at least some “Console output” when I clicked “Build Now” and navigated to the page of that build. The next error, however, has so far been a blocker for me. It is described here and seems to be a limitation of the Maven agent binding address in Jenkins.

I found several blogs recommending the “free-style” Jenkins job type as a workaround, instead of “maven2/3 project”. But that has many limitations and is not an acceptable solution for me.

Finally I noticed that the issue has already been reported in 2013 as JENKINS-19844 “Maven agent socket bind too inflexible (allow Jenkins in virtualized environment)”, but was closed by mistake due to a mix-up of JIRA issue numbers (19844 vs 19884).

I used my account at and reopened the Jenkins issue. Now I can only hope that someone from Jenkins committers team will care enough about this and apply the suggested code changes. Then we have to wait until OpenShift provides a Jenkins version that contains the fix.

Additional Note: I also read about other issues with Maven on OpenShift, e.g. Jenkins having no write access to ~/.m2/repository. I could not verify those problems but they seem to be fixable in ~/.m2/settings.xml, using $OPENSHIFT_DATA_DIR. Via ssh, I was able to create and edit ~/.m2/settings.xml.

Categories: java, jenkins, maven Tags: ,

Java software engineering – reference resources

February 28, 2014 Leave a comment

Using libgdx for cross-platform app development

January 28, 2014 7 comments

I am looking for a framework that allows me to develop modern apps (mobile, web, desktop) all from one Java codebase. I prefer Java because I know it very well, it is already cross-platform and a statically typed language that allows IntelliJ, Eclipse and Netbeans to be better than any dynamically typed scripting language editor could ever be.

Currently my favorite is libgdx. I am planning to use it with IntelliJ Community Edition and with Maven.

By using RoboVM, libgdx even supports iOS.

For user input (forms) libgdx provides the scene2d.ui widgets. I hope that will be sufficient for most of my UIs. Now I just have to get OpenGL to work on my Linux box …

Categories: apps, games, intellij, java, maven Tags: ,