Historically, Jews often lived in regions where it wasn't uncommon for a war to occur. I imagine some shrewd businessmen took advantage of this to profit by doing things like selling equipment or other tools to both sides. However, I'm curious as to whether this is actually allowed in Judaism or not since it could be understood that you are supporting or prolonging a war by engaging in such an activity, thus leading to a loss of lives due to your own selfishness.
What do the Jewish texts say about this historically?