Skip to content

An example project showing how you can migrate from Java to Groovy for fun and profit!

Notifications You must be signed in to change notification settings

JUGGL/java2groovy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

How to switch a project from Java To Groovy

For fun and profit!

Overview

This presentation for the Java Users Group of Greater Louisville shows the path and potential benefits of switching from writing Java code to writing code for the JVM in Groovy. The slides and notes to accompany this presentation can be found HERE.

Build And Run The Project

mvn clean compile exec:java

Description

  • Start with the branch: Step-00, this is a simple Java project using Vert.x.
    • Study the project and make sure you understand what is going on with the lambdas and method references
  • Switch to the Step-01 branch to see that we have now added a new class, but this one is written in Groovy and can work alongside the Java classes!
    • The Maven pom.xml file is set up to be able to compile Groovy source files along with Java source files
    • Look at the comments in the Groovy code to see some interesting syntactic sugar available with Groovy
  • Switch to Step-02 and see that we have converted the original Java source file to Groovy
    • Take note of the syntax differences:
      • Map literals
      • Different method references (Closures actually!)
      • Differences between List syntax in Java and Groovy
  • Switch to Step-03 for a view of some more advanced features of Groovy:
  • Step-04: Bonus! Using Groovy for CLI scripts

About

An example project showing how you can migrate from Java to Groovy for fun and profit!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages