Home > Software Development > Maven Again

Maven Again

November 4th, 2011 Leave a comment Go to comments

Because my new team at VCE uses Maven, I just picked it up again. Last time I used it was when I helped to port the CloudTools to vSphere for the CloudFoundry demo for VMworld 2009 keynotes. Because the project founder Chris Richardson had chosen Maven, I just followed his footsteps forward. After that, I didn’t use Maven.

In the last two years, however, I got a few requests from the community on supporting Maven in VI Java API project. I haven’t got time for it, but noticed it’s actually included in Hudson/Jetkins project. Using VI Java API with Maven is not hard after all. But life could be easy and I will do something there later.

Lost VMs or Containers? Too Many Consoles? Too Slow GUI? Time to learn how to "Google" and manage your VMware and clouds in a fast and secure HTML5 App.

I know developer community is divided on Maven – some love it and some hate it, all with good reasons. I think I am in the group of the others who don’t have a strong opinion about it.

Based on my limited experience with Maven, I think it’s definitely a good tool that makes it easy to build and manager typical projects in particular Java projects. But it seems like a magic box to users, meaning if you have special needs, you may be easily lost and ends up hours on the Web and trials researching for a solution.

Unlike last time I used Maven mainly with command line, I just installed the m2e plugin from from its update site this time. The installation process is pretty straightforward and fast. After that, I got into a trouble that Maven complains it cannot find javac compiler. Having changed the eclipse.ini and the preference page pointing to a JDK by default, I still found the same error. With a few more trials, I got it work after deleting the previous JRE entry in the Installed JREs in the Eclipse preference page. So it seems not enough to set a JDK as default – you have to delete the other JRE. It seems working fine afterwards.

Then, I wanted to try a bit more with something not so quite usual. I decided to create a HelloWorld project for a final jar with a timestamp suffix, such as the vijava API convention: vijava520110926.zip, in which 5 is the version number and the 20110926 is the date of the release.

As it’s not supported out of box, at least I thought that way initially, I got the Maven Build Number plugin. After several Web pages (I found the plugin usage page is a bit confusing) and trials, I still could not get it to work as I wanted. Basically null took the place of timestamp indicating a problem with the generation.

In the end it worked without the Maven Build Number plugin, a pleasant surprise. Here is the pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">


Here is my after-thought from trying Maven. It’s a powerful tool with many great features, some of which are just hidden or not well documented, therefore just do a disservice to users who may either skip them or keep trying but waste much time that should be saved otherwise.

Having said that, I don’t have a silver bullet. But I think that is definitely something all software designer should think about and pay attention to while designing their applications and APIs.

  1. Mikhail Stepura
    November 4th, 2011 at 03:05 | #1

    Hi Steve,
    have you considered to publish VI Java API to the Maven Central?

  2. November 4th, 2011 at 03:13 | #2

    Hi Mihail,
    I’ve thought about it and actually did someting with Sonatype but then got disrupted by other things. Will continue to work on it. Have you done it so be my consultant?

  3. Mikhail Stepura
    November 4th, 2011 at 03:32 | #3

    @Steve Jin
    Unfortunately I have no such experience. Hope that would explain the process: https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide
    I could help in case of maven related questions.

  1. No trackbacks yet.