This is a previous post of mine:
I can say what I do and what works for me, but whether people want to do that is another thing. There are a few guides to the basics of the military interface and how to set up squads and barracks, so I won't go into that.
What works for me is: I usually embark with four military dwarves, each a Novice Axeman and Competent in Shield User, Armor User and Dodging. Defensive skills increase the slowest so I put most points into them, except for one in Axeman to prevent a bad thought from being drafted. I've tried bringing dwarves with Teaching skills and I haven't seen much difference. I bring along four copper battle axes and quickly make four wooden shields after embarking, either bringing along some logs or cutting down some trees, as well as an armour stand for a barracks. I place these dwarves into two squads of two. Squads of two dwarves are the fastest to train, perhaps 25-50% faster even than squads of three. I set them to Active/Training, which they remain in for the rest of their lives. Sometimes one or more will become unhappy but I can't remember any becoming very unhappy, and eventually sparring, drinks, food and slaughter makes them at least quite content. I normally don't bother giving them their own rooms, and it's only as a sentimental reward for my favourite dwarves when I do. However I do try to place them near food, drinks and beds. In fact I often place a training barracks directly over the drinks stockpile to reduce time spent running around, and another barracks guarding the entrance to the fort where soldiers end up once they are trained to a decent level. On average they reach Legendary in Fighting in less than a year, then in Axe in a little over a year. This varies, I had one pair take eight months to become Legendary Axedwarves in my current fort, while the other pair took about a year and a half.
I normally play with the Fortress Defense mod installed, so this is just the start of building up my military. However four highly skilled dwarves can deal with most invaders without that mod, at least I had five, I added an early migrant with skills to them original four, last about seven years with ever being injured in one fort before framerate took its toll. You'll probably want to build up a larger military though, at least in case your main dwarves run off chasing invaders leaving you entrance unguarded, and to do this you may need to train up unskilled migrants. I do this by exactly the same process as above, but it's important to ensure that both dwarves are carrying the same weapon as I've found different weapons can sometimes greatly reduce the training rates. The training times can take a little longer, more like two years to become Legendary in their weapon, but ordinarily this will be fine and you don't need to embark with military dwarves. After this is set up I normally have a training barrack, located over drinks/food, and a fighting barracks at my entrance. Once I have a bunch of skilled dwarves I promote them to the fighting barracks once they reach legendary in Shield User, since this is the most important skill in keeping them alive, particularly against ever-annoying archers.
The fastest way to train dwarves in the crossbow is by setting them hunt. The hunter will need a crossbow, a quiver and bolts, as well as animals to hunt. Hunters will not hunt humanoids such as Tigermen, Badgermen and Moosemen. Hunting provides a fair amount of meat and bones. You will need a butcher in a butcher's shop to butcher the corpses that the hunter returns and a bone carver in a craftsdwarf's workshop to make bone bolts out of the bones produced. Hunting destroys a large number of bolts so you will need these two workshops operating continuously to keep your hunter supplied. Note that hunting can be dangerous, animals rarely attack but some can badly injure a hunter, and it's possible for the hunter to dodge into deep water or off a cliff and die. Embarking with a dwarf proficient in Crossbow and Archery can lead to them being legendary in these skills in less than a year. Unskilled migrants about two years. You can have multiple hunters working at once, but you may need extra butchering and bolt making capacity. You'll eventually run out of animals to hunt, then you'll need to rely training, which I haven't been able to get to work particularly well. However training sessions led by a highly skilled Marksdwarf can lead to relatively fast increases in skills.