❯ Guillaume Laforge

Maven scripting in Groovy

Recently, on Maven’s user list, someone wanted to be able to script Maven with Groovy, like it was already possible with BeanShell or Jython thanks to specific Jelly tags. But unfortunately, Maven didn’t provide that kind of support for Groovy. But there are good news on that front since Jeremy Rayner contributed a nice Groovy Ant task. That Ant task will be available in the upcoming Groovy release (jsr-02), so if you want to play with Maven and Groovy, you’ll have to build Groovy from sources in the meantime. Read more...

How to remove accents from a String

My little puzzle of the day is to find how to remove accents from a String. There are different alternatives, different strategies, but none really suits my needs – or my taste. The naive approach is to use String.replace() to replace manually all characters, with a correspondance table, like “Γ©” should be replaced with “e”, etc. That’s fine for some languages I know, like French or German, or even some latin languages, since we share the same alphabet. Read more...

Maven tip: using Ant's optional FTP task

Maven is a pretty powerful tool, but sometimes, simple things can get complicated… I had to customize my build to upload some files through FTP. But it wasn’t just a mere artifact to upload through FTP to the enterprise repository, so I couldn’t use Maven’s artifact plugin and its FTP method. So the solution was to use Ant’s optional FTP task. At first, it doesn’t seem very complicated, since Maven can basically use any Ant task very easily, but the fact is that this optional Ant task is dependent on another library that you have to add to Maven’s root classloader, otherwise you’ll get a NoClassDefFound! Read more...

Finding styled paragraphs in a Word document

When working with Word documents, you’d often like to be able to extract relevant content automatically thanks to some scripts. That’s exactly what I wanted to do this afternoon. I have a Word document which contains some scripts written with a specific style, and I wanted to extract those snippets, so that I may be able to check that they compile or that the unit tests they represent be asserted successfully. Read more...

Castor tip: generating Java classes for XSD simple types

At work, I’m using Castor XML to Java binding to marshall/unmarshall messages in my Web Services, inside a custom framework (Struts, OJB, JAXM, etc). I have defined my messages as XSD Schemas, and I’m using Castor’s Maven plugin to auto-generate my Java classes at build time. All is good and well… Hmm, almost! Castor’s SourceGenerator generates Java classes for complex types and elements, but not for simple types, and unfortunately, I badly needed to marshall those simple types as well. Read more...

RIFE rocks the pants off of Rails

Rails is kinda cool. Any framework that ease the development of CRUD-oriented webapps is a real time saver. There’s been a lot of well-deserved hype around Ruby on Rails lately. But I’m not sure that’s really that revolutionary. I’ve always thought that a good Java Web framework can do the same. Perhaps with a few more lines of code, since we all know that Java tends to be more verbose than some scripting languages. Read more...

Re: How Groovy can get her groove back

I think Angsuman diserve an answer. It looks like Groovy is in dire needs of a project manager. We’ve got one already. Of course, he’s been pretty busy with his Active* projects lately, but I think now he’s really back on the project. It’s often hard to cope with both a demanding job, and a demanding Open Source project. It’s tough to find time for both. Fortunately, he’s not alone on the Groovy project. Read more...

Groovy's dead, long live Groovy!

Incredible, I’ve just learnt that Groovy was dead, according to Mike! So I understand that’s why CΓ©dric would like to know the final date for the burial. It’s interesting to see how much pressure the Groovy project has on its little shoulders. So far, to my knowledge, I don’t really see any other OSS project for which the users and the blogosphere had so many expectations. Well, back in time, 6 months ago, yeah, we could’ve said Groovy was somewhat a zombie, but I don’t think that’s true anymore, with the latest months activity. Read more...

Groovy code-completion in IntelliJ

JetBrains improved the custom file type support in IntelliJ, in the Irida EAPs. If you have defined your Groovy syntax file correctly, you can have syntax highlighting, brace highlighting, and even… code-completion! In my Groovy syntax file (which works in Irida #3185), I defined two sets of keywords: one for the keywords of the language, and the other one for the Groovy methods, like each(), findAll(), etc. And guess what? Simply hit CTRL-Space as usual, and presto, you can complete your code. Read more...

Auto-completion in a DOS console

When I’m on an old PC, what frustrates me a lot is when I can’t auto-complete file names or paths when I’m in a DOS Console. If your computer (an old Win2K box like I have at work) is not configured for completion, it’s easy to re-enable it by modifying two keys in the registry: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor\CompletionChar HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor\PathCompletionChar To both keys, assign an hexadecimal value representing the key used for completing statements. Read more...