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

295 views
Skip to first unread message

Michael G. Noll

unread,
Dec 7, 2013, 7:11:09 AM12/7/13
to storm...@googlegroups.com
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.

Pros:
+ 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.

Cons:
- 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
  details.


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.

Thanks,
Michael

Colin Fleming

unread,
Dec 8, 2013, 9:30:37 PM12/8/13
to storm...@googlegroups.com
On a slightly related topic, I'd like to table a request to modify the way project.clj works in Storm for a better out-of-the-box experience with IDEs. Currently Storm stores some project data in files external to project.clj and pulls them in using slurp, and then creates the defproject form using eval. While a neat (or curious, anyway) trick, this tends to play havoc with IDEs which synchronise lein dependencies using an in-process call to Leiningen functions since CWD is never set to the project home dir (and in fact can't be set using Java). I'm the author of Cursive Clojure (http://cursiveclojure.com) which works like this, and I'm pretty sure CCW does too. I've had at least one user report that they can't import the Storm project using Cursive.

Currently this seems to be done to manage the version and the dependencies. It seems that the dependencies probably don't change frequently enough for this to be a big win, and there are several lein plugins to help with version management which would do it in a more tool-friendly way.

Cheers,
Colin

Zehao Jin

unread,
Dec 9, 2013, 4:57:46 AM12/9/13
to storm...@googlegroups.com
I totally agree. In fact, I thought it was a new maven version to use 'm2-pom.xml' to build project when I saw it at the first sight. After I read it, I just rename it to 'pom.xml' and import the project to netbeans.
Reply all
Reply to author
Forward
0 new messages