Porting Mantis Data into Jira

Unfortunately, if you use Jira OnDemand, they don’t have direct functionality to import your Mantis database into Jira. That said, they still allow you to import CSV files, with which you can map different columns to different elements in Jira. Overall this is pretty slick and worked pretty much as expected without too much confusion.

It probably wouldn’t be too hard to come up with a couple queries to get you the CSV you need, but I opted to just get the CSV via the interface. Only issue here is that it’s a two part process — the CSV export in Mantis only gets the tickets themselves — none of the comments/bugnotes. As a result if you want to port comments over as well, you have to dump some info from the database. I wrote a script to aid with this process so that I would end up with two Mantis CSV files I could upload to supplement the initial CSV upload. Luckily, you can keep modifying specific tickets with subsequent CSV files, so the information add to these CSVs should make it into the system on top of other info you’ve already uploaded. Perhaps in the future I will just open source a script to automate this a bit more, but since it seems like a one off process I’ll just go with the slightly more manual (but less code) method.

Initial Mantis issue CSV

To get the initial Mantis issue CSV, I just made sure my filters allowed me to display all Mantis issues ever (we have around 7000 issues) — this might take a moment to load depending on how large your dataset is. For whatever reason, the export only takes the results of whatever filter you’re using — I couldn’t find an option to export ALL data, so instead I just opened up the filters to include everything. I also modified the columns for the CSV (My Accounts -> Manage Columns) so that I only grabbed the information I needed since Jira will ask you to map specific columns to different elements within Jira.

BugNotes and Relations CSV

I wanted to make sure issue comments and relations made it into Jira as well, since the Mantis CSV export does not account for these. So I wrote a script to do two simple queries and after formatting slightly, output the data into CSVs.


// date submitted; username; comment

2012-01-01 01:01:01; victor; comment goes here

Once that’s all set, all that’s left is to import the files in order. One gotcha is that the “severity” was required in both CSVs for some reason, otherwise Jira would throw a bunch of errors — it seems part of the issue here is that each import expects some amount of basic information, but because I’m doing three CSV imports, this causes issues because it expects one import with all the information in one place. So it seems like they decide to set defaults for certain values if your CSV doesn’t contain that particular column.