Well, after several days of trying, about 5 in-game years, and eight dead dwarfs burned up in dragonfire, I have achieved success!
I have successfully hatched five newborn dragons, three females and two males, which you can see in the above picture happily lounging in their luxurious hatchery, the size of a great hall, fully engraved, and equipped with adamantine nest boxes and statues. They are too young to breed yet - they should reach sexual maturity in 4 years, or so I've modded them.
I think breeding dragons in DF was harder than breeding pandas in captivity is in RL. Much !!SCIENCE!! was obtained through this foray into dragon husbandry, from which I can affirm with full certainty the following facts:
-In order for a megabeast to breed, you
have to remove the megabeast tag, as pointed out by a fellow user above, and add the child tag, of course.
-Not every batch of eggs laid with a male present gets fertilized. What is more, I think fertilization is sorted out the moment the eggs are laid, so they won't be fertilized two years in if they weren't at the beginning. The trick lies in trying to find out how long should it be for an egg of a given size to hatch, and once that time is exceeded, remove the unfertilized egg, have the female lay new ones, and hope those get fertilized.
-I can't guess the odds a given egg has of being fertilized, but I would say it's around 30% or less, if you only have a single male and female of breeding age. My dragon female had at least seven failed batches to only 2 successful ones.
-Having more than one male of the same species in the map increases chances of fertilization. I was able to prove this with my separate monitor lizard and asp breeding projects. With the monitor lizards (had three males at the beginning), almost every batch of eggs was fertilized (resulting in a massive lizardsplosion eventually, got like 1000 meat out of it), and with the asps (had four males) every batch was fertilized. My eagles, however, with only one male, have yet to lay a successful batch, after three tries.
-Modded in egg-layers don't produce edible eggs. The eggs will get put in the food stockpile but will never be selected for cooking. I don't know how to circumvent this.
-Forbidding the eggs has no effect on their hatchiness. It is useful to avoid dwarves hauling off the eggs to the food stockpile.
-If the egg size is more than 200, it's not worth the wait as it is not easily manageable, unless the creature lays an inordinate amount of eggs per batch.
-Aggressive tame creatures, such as a dragon you capture, are immune to traps, sadly.
-Pet dragons are the best.
So, to recap, in order to have pet dragons:
-You have to mod them to be able to breed (removing the megabeast tag, adding child tag, appropriate egg part), after capturing a breeding pair (took 5-6 years of waiting).
-They will both be aggressive after taming, killing and roasting your dwarves if given the slightest chance.
-I put the female in a pre-made room with nest boxes and an additional, long corridor with a door at the end, connected to the fortress. Once the eggs are laid, you wait and pray for them to hatch.
-If they don't hatch in a given amount of time (depends on what size you give the eggs), you put a useless dwarf in the end of the corridor as bait, to aggro the dragon into attacking him. Once the dragon is chasing after the dwarf, you let another dwarf go after the eggs in the nestbox. After he grabs it, you lock the door. The dragon, her bloodlust satisifed, happily goes into the nest room and lies more eggs.
-Repeat until successful.
-Sometimes the dragon would finish too quickly with the bait dwarf, and go after the dwarf stealing the eggs, resulting in another death, or in serious injury. Both the bait dwarves (sure deaths) and the dead egg thiefs, are given adamantine sarcophagi, to honor their sacrifice so the fortress could have the coolest pets ever.
-Dragons hatched from aggressive mothers won't be aggressive. They are as docile as kittens, and I have yet to catch them spewing bouts of fire at random. They are well behaved and won't roast stuff just for kicks.
-After you get a newborn female, it is advisable that you dispose of the original mother so you don't have to deal with her bitchiness anymore. Dragon meat is tasty. Or you could just lock her in the depths and forget about her, but it's sad to have a dragon and let it go to waste.
Thoughts?