Tools for migrating from Maven to Pants?

206 views
Skip to first unread message

Dobromir Montauk

unread,
Oct 31, 2014, 6:37:04 PM10/31/14
to pants...@googlegroups.com
Hi folks,

I've done a few searches in this group and Google and haven't been able to find any tools for building a Pants BUILD tree from an existing Maven repo. Does something like that exist? It would help us very much to auto-generate BUILD files that we can use to bootstrap a migration...

Thanks,
Dobromir

John Sirois

unread,
Oct 31, 2014, 6:43:02 PM10/31/14
to Dobromir Montauk, pants-devel
We have no tool in the codebase, but Twitter wrote a very Twitter-specific tool as a standalone python app and Square has written - IIUC - a more robust tool - I think also in python.  I'm not sure how much work it would be or how useful it would be to put either of these tools out there, but these are the 2 I know of.

This is clearly something that will be asked for frequently, so a tool would be nice for pants to have.

Dobromir Montauk

unread,
Oct 31, 2014, 6:53:55 PM10/31/14
to John Sirois, pants-devel
Thanks for the quick response. Is there any chance the Square folks would be willing to share the code so we could see how applicable it is to our situation? 

John Sirois

unread,
Oct 31, 2014, 7:05:56 PM10/31/14
to Dobromir Montauk, pants-devel
One thing to note while you're waiting on responses: transliterating from pom to BUILD misses one of the key (psychological) benefits/biases of pants: the shift from "project" to "library" as the focus.  When you 1st auto-convert from pom to BUILD you'll very likely have fewer library targets than are otherwise natural or advisable unless you had fearless and very active pom refactorers that relentlessly broke down project the minute they got too coarse-grained and started to become kitchen-sinks.  I offer no solution but just present that after a conversion there should probably be some knowledge of the fact that dropping a BUILD in a pom root src tree can help you slice out a thin library and start to decompose.

Eric Ayers

unread,
Oct 31, 2014, 7:13:26 PM10/31/14
to John Sirois, Dobromir Montauk, pants-devel
I dumped a copy of our scripts here:  https://github.com/ericzundel/mvn2pants

They are square specific and I made no attempt to get them to run, but you can get an idea of what we've done.

checkpoms.py is the main script we run.  There are various supporting scripts like pom_to_BUILD to convert a single pom.xml.

Eric Ayers

unread,
Oct 31, 2014, 7:17:18 PM10/31/14
to John Sirois, Dobromir Montauk, pants-devel
I agree with John.  At Square we have been making lots of small nested maven projects for other reasons, so that helped us some.  We have a big repo with lots of developers and we still don't have every project working with Pants, but we're getting closer.  We'll be using the pom --> BUILD auto generation to keep all the dependencies in sync.

Ity Kaul

unread,
Oct 31, 2014, 7:43:22 PM10/31/14
to Eric Ayers, John Sirois, Dobromir Montauk, pants-devel
Agree with both John and Eric. The move small nested projects would not be very easy to automate (unless you already have that structure).
We have similar scripts, although looking at what Eric shared -- they are similar. 
We could possibly have a tools section for new adopters of pants and add these there. I am guessing we are going to get asked this more as we move forward. 
--
Ity Kaul
Twitter Engineering
Reply all
Reply to author
Forward
0 new messages