How to import attachments using jira importer plugin?

Please help - I could not find information on how to do it.

I create ExternalIssue class and fill all needed fields in my importer client class. During the process I create several ExternalAttachment classes using the following constructor:

 ExternalAttachment(String name, File file, Date date)

The file contains the full path name of the attachment file, somewhere on the local disk.

and put them into list, then calling issue.setAttachments(list);

After process is finished, the imported issue has no attachments. The log also shows no signs of any attachments.


What am I missing?

2 answers

Seems like the DefaultJiraDataImporter.CreateIssue pays no attention on the contents of the ExternalIssue attachments field and requests attachments from the DataBean. The default implementation of the  getAttachmentsForIssue method just returns empty collection. The "real" implementation should return attachments for the issue, like this:


public Collection<ExternalAttachment> getAttachmentsForIssue(ExternalIssue externalIssue, ImportLogger log)
return externalIssue.getAttachments();

This is really a strange behavior.

Another strange thing is that JIRA deletes attachment files from their source location for unknown reasons.

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,760 views 11 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot