This has been bothering me since I upgraded to Yosemite earlier this summer. I finally found an answer: turn on iCloud syncing for email. I did not need do any if the file copying mentioned in the linked solution.
In case you’re wondering: No, I am not a rules fanatic, but one IMAP email account through my hosting company has an issue with spam. I turned on Spam Assassin, which tags the junk, and then I use a rule to put those messages in the junk folder, just in case there was a false positive.