Google Groups

storm-starter suggestion: rename m2-pom.xml to pom.xml

Michael G. Noll Dec 7, 2013 4:11 AM
Posted in group: storm-user
Hi everyone,

I'd like to get your feedback on the idea to rename m2-pom.xml in storm-starter the standard pom.xml for Maven.

From what I understand the reason to have a custom name for pom.xml derives from the fact that leiningen supports a command to auto-generate pom.xml from project.clj via `lein pom`.  Here, `lein pom` will overwrite any existing pom.xml, hence the current use of m2-pom.xml.

Now what's the problem with m2-pom.xml and the storm-starter's Maven setup?

First, using a custom filename makes it more cumbersome to execute maven commands -- all commands must include "-f m2-pom.xml":

    # "normal" Maven setup
    $ mvn clean
    $ mvn test

    # in storm-starter
    $ mvn -f m2-pom.xml clean
    $ mvn -f m2-pom.xml test    # same for longer commands such as running a specific topology

Second, popular IDEs such as IntelliJ IDEA and Eclipse cannot auto-import storm-starter as-is because they are only looking for pom.xml files.  I confirmed this with IDEA 12 myself, and found comments of others that they had to manually rename/copy m2-pom.xml to pom.xml for Eclipse, too.

So here is a short list of pros and cons for renaming m2-pom.xml to pom.xml.

+ Standard maven commands work, which is nice for Storm beginners
   (which is the target audience for storm-starter)
+ Out-of-the-box support to work with storm-starter in popular IDEs such as
   IntelliJ IDEA and Eclipse.

- Old storm-starter maven instructions found elsewhere (e.g. blog posts)
  will not work anymore, because m2-pom.xml will be gone.  This
  can be partly mitigated by a README update.  But I don't know of any
  good way to adjust the maven setup so that it, say, automatically throws
  a deprecation warning about m2-pom.xml automatically and informs the
  user to use pom.xml instead.
- When you run `lein pom` it will overwrite the existing pom.xml file, which
  means this command should be used with special care.  See below for

Some background on `lein pom`:
I suppose that only developers of storm-starter would typically run `lein pom` (e.g. it's not even mentioned in the README) in order to sync the maven setup with the leiningen/project.clj setup, notably for any upstream Storm changes.  One catch here is that the deps defined in project.clj and m2-pom.xml actually differ slightly, because e.g. there are some libs that we use in the Java code (e.g. Google Guava) but not in the Clojure code.
    That being said, from what I understand -- even taking those lib differences aside -- it has not been possible anyways to use an auto-generated pom.xml from `lein pom` as-is for our Maven setup.  So my current take on this suggested change is that it's not really a major change for storm-starter developers, and we'd trade developer convenience for improving users' out-of-the-box experience (which is a trade I personally would +1 in general).

    Lastly, while I am not a representative sample I have been getting emails from people how they can use storm-starter with Eclipse or IntelliJ (pom.xml issue), but so far I have yet to be asked about `lein pom`. :-)

What do you think?  I already have the "rename to pom.xml" code ready in a local feature branch, but I want to get other people's opinion first before making any changes.