Yep, I did it - I gave m2eclipse another try, after reading an interview with Jason van Zyl on InfoQ several weeks ago. In it Jason stated that Sonatype is commiteing 8 full-time employees working on the m2eclipse plugin now. As it turns out, I am impressed. For me m2eclipse is finally there where I need it to be. In the past I looked at it several times but it never fit my needs back then. For my jRecruiter project, I am using a slightly modified Appfuse-based Maven pom. As in Appfuse, my project uses Maven profiles to target various different databases such as Postgres and MySql.
For my project, depending on the chosen profile, Maven will filter a file called jdbc.properties and replaces several properties with database specific values during the processing of resources (mvn process-resources).
Here are some properties that are being filtered:
jdbc.driverClassName=${jdbc.driverClassName}
jdbc.url=${jdbc.url}
jdbc.username=${jdbc.username}
jdbc.password=${jdbc.password}
hibernate.dialect=${hibernate.dialect}
In the olden pre-m2Eclipse days, I created my Eclipse project through Maven from the command line using e.g. mvn eclipse:eclipse -P postgresql. Then in Eclipse, I had to manually include a custom jdbc.properties file with build specific properties since Eclipse by itself can't do that type of filtering.
It worked, however, as you can imagine, this can be quite tedious, especially during the early development stage where your project's dependencies may change frequently.
But now m2eclipse is able to handle resources filtering for me from within Eclipse, which is really nice. Additionally, I can manage my dependencies using m2eclipse, and what is even better, I can visualize them as well. This is especially a live-saver when I need to figure out certain transitive dependencies.
This came in quite handy when I converted my project over to logback and SLF4J and needed to figure out all the commons-logging dependencies.
I am using m2eclipse for several weeks now, and I haven't come across any major drawbacks, yet. Granted, I haven't really dug deeply into m2eclipse's features as I primarily use only the subset discussed above, but if you use Eclipse and your project is built using Maven, please take another look at m2eclipse.
No comments:
Post a Comment