Sunday, November 15, 2009

My First Intellij Plugin

During my work at Quest Software I worked on a project that required all logging messages in a properties file PER PACKAGE!!!

I know it is perfectly reasonable to replace hard-coded strings with properties files, but I always had a single properties file per project, and here, each package had a different file.

Our projects were built with Maven, so our folder structure there was well defined.
I took advantage of this to write a small Intellij plugin that opens the correct properties file.

The use-case is : I am writing some code in a class, and I want to log something, I have a menu with "Open LogResources.properties"

My XML Checker Maven Plugin


Every application I used or written so far had an XML reading/writing feature. Why not? It's so easy and useful. RSS feeds are XMLs, Jetif uses it, Maven, Ant, Hibernate, Eclipse, Intellij IDEA, Tomcat and the list goes on.



Show me an application that doesn't use XMLs
  and I will show you missing features.


I like to use JAXB for writing and parsing XMLs. I always add auto-generated XSDs. Even though I have XSDs and appropriate editors, I still don't feel very safe because there is a problem with JAXB - some of the errors are discovered only in runtime. Since I like to be safe, and automated, I found it best to write a generic plugin that checks if JAXB is able to process the XMLs.

My Application Maven Plugin

Maven is a great tool, but I find sometimes it is missing little, very helpful things.

Documentation for example, is lacking. However this was improved by version 2.0.

However, the thing I find missing most of all is a plugin that takes my jar and all needed dependencies, build a "run.bat", zips and deploys.

The assembly plugin claims be good for this purpose, but I didn't like it. First of all it has an external XML, and my first experience with it was frustrating.
I couldn't find a way to generate my "run.bat". (how annoying can it be to maintain classpath in scripts?)

So I wrote my own, quite useful, plugin. I call it the application plugin.


Jetif and My Jetif Maven Plugin

Small Introduction to Jetif



Over the years, I found myself writing server code for webapps. While having fun not worrying about UI, I came across a problem. The QA couldn't check my code, they had to have a UI.

You might suggest the QA write code - but that means integration.

What you need in such a case is something similar to JUnit but only with some kind of User Interface. And then came Jetif.