Coding

Gradle Goodness: Specify Wrapper Version and Distribution Type From Command Line

Posted on by  
Hubert Klein Ikkink

Gradle has the built-in task wrapper to create a Gradle wrapper. The Gradle wrapper can be part of our project so other people can build our project with Gradle, without the need for them to install Gradle. Also if we specify the Gradle wrapper we can make sure the correct Gradle version is used. To specify the version we must use the option --gradle-version. This version can be different than the Gradle version we use to create the Gradle wrapper. Since Gradle 3.1 we can also specify the distribution type of the Gradle wrapper. We choose between a binary distribution or the all distribution, which contains documentation and source code. Especially IDEs like to have the all distribution type, so they can provide better help in their editors. With the following wrapper command we create a wrapper for Gradle 3.1 and the all distribution type. For a binary distribution we either use the value bin or we don't specify the option, so Gradle falls back to the default value bin.

$ gradle wrapper --gradle-version 3.1 --distribution-type all
:wrapper

BUILD SUCCESSFUL

Total time: 1.012 secs

$

Continue reading →

Spocklight: Custom Default Responses for Stubs

Posted on by  
Hubert Klein Ikkink

Although I couldn't make it to Gr8Conf EU this year, I am glad a lot of the presentations are available as slide decks and videos. The slide deck for the talk Interesting nooks and crannies of Spock you (may) have never seen before by Marcin Zajączkowski is very interesting. This is really a must read if you use Spock (and why shouldn't you) in your projects. One of the interesting things is the ability to change the response for methods in a class that is stubbed using Spock's Stub method, but have no explicit stubbed method definition.

So normally when we create a stub we would add code that implements the methods from the stubbed class. In our specification the methods we have written are invoked instead of the original methods from the stubbed class. By default if we don't override a method definition, but it is used in the specification, Spock will try to create a response using a default response strategy. The default response strategy for a stub is implemented by the class EmptyOrDummyResponse. For example if a method has a return type Message then Spock will create a new instance of Message and return it to be used in the specification. Spock also has a ZeroOrNullResponse response strategy. With this strategy null is returned for our method that returns the Message type.

Continue reading →

Running SonarCube on your laptop using Docker

Posted on by  
Jeroen Resoort

I recently wanted to do some source code analysis and found it difficult to find a good eclipse plugin. Luckily, it's now very easy to get your own SonarCube server running. Basically you only need a docker installation and a few simple steps. To start a SonarQube instance you run the following command:

docker run -d --name sonarqube -p 9000:9000 -p 9092:9092 sonarqube

Continue reading →

Gradle Goodness: Change Gradle Wrapper Script Name

Posted on by  
Hubert Klein Ikkink

With the Gradle Wrapper task we can specify the name of the generated script files. By default the names are gradlew and gradlew.bat. The Wrapper task has the property scriptFile. We can set a different value for this property to let Gradle generate the script files with a different name.

In the following example we use the value mvnw (they will be surprised the build is so fast... ;-)) as the value:

Continue reading →

Gradle Goodness: Lazy Project Property Evaluation

Posted on by  
Hubert Klein Ikkink

Sometime we need to define a project property in our Gradle build file for which the value must be evaluated later than the assignment. We can do this in different ways in Gradle. For example for a String type property we can rely on Groovy's support for lazy String evaluation. If the property is of a different type we can use Closure to define the value. The Closure code is not executed during the configuration phase directly, but we can write code to invoke the Closure at the right moment and get the value. Finally we can use the afterEvaluate method of the Project class to define a lazy property. Let's look at the different options we have with some code samples.

First we look at a lazy String property. We illustrate this with an example of a multi-project build with the following layout:

Continue reading →

Het ontstaan van de passie voor het moderne maken

Posted on by  
Rob Brinkman

Als JDriven ervaren we elke dag hoe schaars het talent is dat nodig is om onze klanten optimaal te ondersteunen. Deels omdat we op zoek zijn naar echte specialisten maar vooral omdat we verwachten dat collega’s een passie hebben voor hun vak en erg gemotiveerd zijn om mooie dingen te maken. Deze passie is voor ons essentieel en wat mij betreft is dit de basis van succesvol software ontwikkelen oftewel het moderne maken. Het ontwikkelen van een specialisme vergt tijd. Het vindt eigenlijk pas plaats tijdens een studie en wordt continu ontwikkeld tijdens je verdere carrière. Maar de passie voor het vak, dat wat mijn collega’s uniek maakt, wordt al veel eerder gelegd. Zonder uitzondering blijkt het ontstaan van deze passie te herleiden naar één of twee toevallige gebeurtenissen in hun jeugd: een ouder met een passie voor electronica, een vriendje (of vriendinnetje) met een computer etc..

Zelf heb ik het geluk gehad dat ik ook als kind de passie voor het maken heb mee gekregen. Door mijn opa al timmerend aan het werk te zien; een speelgoed tractor, een bed, een klimrek. Daarna werd het al snel mee timmeren en samen een vogelhuisje maken. Toen er via het werk van mijn vader een computer bij ons in huis kwam kreeg ik de kans om met het moderne maken in aanraking te komen. Samen met mijn vader de eerste programma’s schrijven zoals een muziekspeler, een spelletje en een catalogus om mijn muziek-verzameling in vast te leggen. De optelsom van deze ervaringen is van grote invloed geweest op mijn toekomst. Niet omdat ik destijds uitstekend heb leren programmeren, maar omdat mijn passie voor het vak daar is ontstaan en ik me op basis van die passie verder heb kunnen en mogen ontwikkelen.

Continue reading →

Antlr is Awesome

Posted on by  
Niels Dommerholt

In this post I will show you how to integrate the Antlr4 parser generator in your Java project to generate a parser and use the parser to parse simple mathematical expressions. It’s a good starting point if you need to do any kind of parsing in your Java project. I’ve also provided a runnable Maven project. Original post

About a year ago I had to implement a query language in a project I was (and currently still am) working on. We’re creating a specialized search engine where users can use a GUI to query the system. Power users need to be able to type in search queries and a requirement for this query language is that it would be both simple and powerful. This led to us ending up with something fairly similar to the where clause in a SQL select statement.

Continue reading →

AngularConnect 2016 conference report episode 1

Posted on by  
Emil van Galen

AngularConnect 2016, held on the September 27th and 28th, was the first Angular conference since the final release of Angular 2.0. From our company (JDriven) we, 3 front-end loving colleagues, attended this conference and would like to share some of the noteworthy things we’ve learned during the conference. To allow us some time to write things down as well digest what we have learned, we intend to publish this conference report as a series of 2 or 3 episodes. In the (first) episode we will go into the topics of performance, support (also for Angular 1.x) , tooling and security. Future episodes will most likely go into the topics architecture, mobile, data, seo and / or testing.

One of the hottest topics during the AngularConnect 2016 was performance.

Continue reading →

shadow-left