Pages

Showing posts with label Groovy. Show all posts
Showing posts with label Groovy. Show all posts

Friday, August 8, 2014

Syntax Highlighting for Groovy in Kate

Groovy has been my scripting language of choice for some time now and since I'm running KDE I'm using Kate for quick scripts. And even though Groovy has been around for quite some time and Kate supports a myriad of syntax highlighting modes, Groovy for some odd reason isn't one that comes bundled with Kate out of the box. At least not up to my current KDE version 4.13.2 running on Ubuntu derivatives - neither on (K)Ubuntu nor my latest install of Mint 17 KDE.

Thankfully Kate's syntax highlighting is extendible and the Groovy project provides plugins for various editors including kate. Unfortunately the instructions on  this page have never worked for me on an Ubuntu based system. The path names listed on that plugin page weren't correct with any install of KDE out of the repository.

To make Groovy syntax highlighting work, I instead had to place the groovy.xml file into

~/.kde/share/apps/katepart/syntax/

in order to make it available for a single user or in

/usr/share/kde4/apps/katepart/syntax

to make it available system wide. Restart Kate, here you go. It gets picked up automatically when you save a .groovy file and resides in the Tools -> Highlighting -> Sources menu.

Thursday, November 28, 2013

Making Java Groovy

Manning Publications recently published "Making Java Groovy" by Ken Kouson so I went and bought it. I often buy books about topics I'm interested in and read them on the train to work to find out if the described technologies can help me with my current or future projects. I really like Manning books because they are usually a good mixture between tutorial/reference and just good introduction into technologies.

Working in an almost Java-only environment have been interested in Groovy for quite some time. Most Java developers know the problem: You have all kinds of libraries or at least code snippets that already capture your business logic. But if you want to run a quick script to make use of it, you either have to create a full blown Java app with all it's draw-backs, or go for some other scripting language that can do the trick with as little code as possible; for my quick-and-dirty scripts I usually resorted to one of bash, PHP or Perl. For more complicated tasks I bit the bullet I wrote Java app, bundled into one big jar with a myriad of command line parameters to be able to switch environment, figure out best settings and what not.