This is a sweet gradle trick for those of you working on multi-module projects, if you are looking to centralize some of the configuration in the parent gradle build, and avoid repeating configuration / build code across sub-modules. Let’s say you have the following gradle project structure (see image below) where project A is the […]
Posts Tagged: groovylang
Collection Sorting — Java vs Groovy
With the introduction of lambdas in Java (not so) recently, some argue that Groovy lost some of its thunder, as closures are now first class citizens in the JDK. However, as I’m about to show, while lambda’s pushed the Java language a great deal forward, Groovy still makes a lot of things incredibly easy (and […]
A Bit of Lovin’ for the Groovy Object Initialization
I’m going to spread some lovin’ today for the widely-used yet less appreciated feature in Groovy which allows creating a Java bean and setting its properties in one line. Especially when dealing with unit tests this saves me a great deal of time and frustration. If you ever worked with “pure” (??) Java beans, then […]
Parallel : Groovy and Java Streams
This is something that every now and then I have to do: check whether either one or all elements of a collection meet a certain criteria. The standard code initially in Java involved a for loop and iterating through the collection explicitly and checking the condition at each step. Then Apache Commons came on with their […]
Goodies in Groovy from DefaultGroovyMethods
If you ever programmed in Groovy language, you probably “enjoyed” (maybe without realising) the joys of DefaultGroovyMethods. What you probably don’t realise is that you can override these methods to customize your classes — and occasionally generate some code that’s not that easy to read. (Do you remember the old C++ way of overriding operators […]
Small Note on gradle’s afterEvaluate
If you use gradle and you took the path to write your own gradle plugins (try it, it’s fun!) to make your build process more … “enjoyable”, then this might come in handy one day. I have worked on a few gradle plugins, some of them inside the Netflix Nebula suite, some of them outside Netflix […]
Why You Should Use Default Methods in Java 8 Interfaces
With Java 8, Oracle introduced the concept of “default methods” in interfaces (and if you really haven’t heard of this — wtf?? — you can read more here about it: https://docs.oracle.com/javase/tutorial/java/IandI/defaultmethods.html). This argue some is a step towards multiple inheritance and as such should be banished from the oh, so pure! Java language. Others point out […]
Netflix Nebula Gradle Plugin and project.version
If you use the Netflix OSS Nebula plugin in gradle and you use it for automatic versioning, incrementals etc then you will come across this at some point. (And in the case that some of you have already encountered this, I have to ask why did you not write the blog post I needed when […]
Checkstyle, Findbugs, PMD and the Likes
I’ve been using the above (and a few others like CodeNarc) code quality plugins for quite a bit and I thought I’d give my 2 cents here on a matter of style: the way you can suppress checks in each of these tools. I do like the way Checkstyle allows you to define what to […]
Gradle — Customize Startup Scripts for Java Applications
OK, so you use Gradle to build your Java projects. And if you use the application plugin in Gradle then you get also the startup script generation so you can ship that straight into your prod servers. Thing is, the application plugin generates a “standard” script — which does include the classpath and a whole […]