First of all, the passage you mention (AN 5.177):
"Monks, a lay follower should not engage in five types of business. Which five? Business in weapons, business in human beings, business in meat, business in intoxicants, and business in poison.
"These are the five types of business that a lay follower should not engage in."
http://www.accesstoinsight.org/tipitaka/an/an05/an05.177.than.html
The tika provides a bit of clarity on this:
satthavaṇijjā ti āvudhabhaṇḍaṃ katvā vā kāretvā vā kataṃ vā paṭilabhitvā tassa vikkayo.
"Business in weapons" means, having made instruments used as weapons, or having had them made, or having obtained them already made, the selling of those [instruments].
So, again it appears to be limited to the activities of a merchant. On the other hand, the entire sutta only describes the activities of a merchant (vanijja), so it doesn't actually make allowance for other ways of making money off of weapons manufacture and/or war. It is my guess that this is to be used as a guide on which to judge the morality of more indirect forms of martial employment (similar to manufacturing poison, etc.).
I don't think one should simply draw the line at commerce and say that any other war-based employment is okay. Instead we should ask what is wrong with selling weapons and apply the same principle to other similar activities.
One interesting exemption seems to be related to transportation and care of weapons. The commentary to Dhp 124 tells a story of a woman who cleaned and prepared weapons for her husband to catch and kill animals. She was a sotapanna and the Buddha said she was blameless:
The monks began to discuss the matter, saying, “So Kukkuṭamitta has a wife, and when she was a mere girl she obtained the Fruit of Conversion; yet she married this hunter and by him had seven sons. Furthermore, during all this time, whenever her husband said to her, ‘Bring me my bow, bring me my arrows, bring me my hunting-knife, bring me my net,’ she obeyed him and gave him what he asked for. And her husband, taking what she had given him, went and took life. Is it possible that those who have obtained the Fruit of Conversion take life?” Just then the Teacher approached and asked, “Monks, what is it that you are sitting here now talking about?” When they told him, he said, “Monks, of course those that have obtained the Fruit of Conversion do not take life. Kukkuṭamitta’s wife did what she did because she was actuated by the thought, ‘I will obey the commands of my husband.’ It never occurred to her to think, ‘He will take what I give him and go hence and take life.’ If a man’s hand be free from wounds, even though he take poison into his hand, yet the poison will not harm him. Precisely so, a man who harbors no thoughts of wrong and who commits no evil, may take down bows and other similar objects and present them to another, and yet be guiltless of sin.” So saying, he joined the connection, and preaching the Law, pronounced the following Stanza,
124. If in his hand there be no wound,
A man may carry poison in his hand.
Poison cannot harm him who is free from wounds.
No evil befalls him who does no evil.
I think it's easy to see how this is different from actually helping to create weapons, but it does show that, as always, the mind is most important.
As to your final question, this is never a very good defence; it's like a butcher saying he has to kill because he has no other way to make money. While that might mitigate the evil, it doesn't make it categorically different from any other act of murder.
There is another story in the Jataka (JatA 31) that exemplifies the Buddhist view on this sort of situation. When Magha was reborn as Sakka, king of the angels of the thirty-three, three of his wives were also born in heaven due to their meritorious deeds. His fourth wife was born as a crane, and Sakka admonished her to keep the five precepts, as follows:
But Highborn, having performed no act of merit, was reborn as a crane
in a grotto in the forest.
"There's no sign of Highborn," said Sakka to himself; "I wonder where
she has been reborn." And as he considered the matter, he discovered
her whereabouts. So he paid her a visit, and bringing her back with
him to heaven shewed her the delightful city of the Devas, the Hall of
Goodness, Thoughtful's Creeper-Grove, and the Tank called Joy. "These
three," said Sakka, "have been reborn as my handmaidens by reason of
the good works they did; but you, having done no good work, have been
reborn in the brute creation. Henceforth keep the Commandments." And
having exhorted her thus, and confirmed her in the Five Commandments,
he took her back and let her go free. And thenceforth she did keep the
Commandments.
A short time afterwards, being curious to know whether she really was
able to keep the Commandments, Sakka went and lay down before her in
the shape of a fish. Thinking the fish was dead, the crane seized it
by the head. The fish wagged its tail. "Why, I do believe it's alive,"
said the crane, and let the fish go. "Very good, very good," said
Sakka; "you will be able to keep the Commandments." And so saying he
went away.
Dying as a crane, Highborn was reborn into the family of a potter in
Benares. Wondering where she had got to, and at last discovering her
whereabouts, Sakka, disguised as an old man, filled a cart with
cucumbers of solid gold and sat in the middle of the village, crying,
"Buy my cucumbers! buy my cucumbers!" Folk came to him and asked for
them. "I only part with them to such as keep the Commandments," said
he, "do you keep them?" "We don't know what you mean by your
'Commandments'; sell us the cucumbers." "No; I don't want money for my
cucumbers. I give them away,--but only to those that keep the
Commandments." "Who is this wag?" said the folk as they turned away.
Hearing of this, Highborn thought to herself that the cucumbers must
have been brought for her, and accordingly went and asked for some.
"Do you keep the Commandments, madam?" said he. "Yes, I do," was the
reply. "It was for you alone that I brought these here," said he, and
leaving cucumbers, cart and all at her door he departed.
Continuing all her life long to keep the Commandments, Highborn after
her death was reborn the daughter of the Asura king Vepacittiya, and
for her goodness was rewarded with the gift of great beauty. When she
grew up, her father mustered the Asuras together to give his daughter
her pick of them for a husband. And Sakka, who had searched and found
out her whereabouts, donned the shape of an Asura, and came down,
saying to himself, "If Highborn chooses a husband really after her own
heart, I shall be he."
Highborn was arrayed and brought forth to the place of assembly, where
she was bidden to select a husband after her own heart. Looking round
and observing Sakka, she was moved by her love for him in a bygone
existence to choose him for her husband. Sakka carried her off to the
city of the devas and made her the chief of twenty-five millions of
dancing-girls. And when his term of life ended, he passed away to fare
according to his deserts.
A true follower of the Buddha would not kill to save their own life.