My best guess would be invested before the war started, and if ww3 start it would be too late to invest! That's just my two cents.
WW3 would mean the end of the world, no one can escape nuclear, not even the all might stock market...
I think if World War III happens, there wouldn't even be any stock to invest in. Companies and businesses will surely fall down with the war. People would think more on how to survive a even for a day than investing in business. Most business owners would be so afraid to even open their businesses.
If its an all out war- probably any steel or metal companies. Obviously stocks like Glock, or any weapon manufacturers. However, if this is going to be a huge war, they would more than likely close wall street.
The second suggestion coupled with lots of ammo and lots of guns. That is to stop other people from stealing your food supplies. As for the diamonds and gold, in the past they held value, but in the past wars did not kill off large amounts of the populations. Probably gold will have no value, since you will just be able to walk into dead people's vacant houses and take the gold if you want to. Buy lots of sugar, chocolate, candy bars, coffee and tea. These are items that will not spoil, and you can pack a lot of them in small space. After there is a general economic collapse, people will go back to subsitance living. A steady diet of eating deer and greens will get boring. For a candy bar you probably can get the guy to do anything for you.
Haliburten, Lockheed Martin... pretty much any defense contractor. On a secondary level, commodities, mining companies, staple food producers.
I'm not sure whether I'd be putting my money into any stock markets, given that I wouldn't know if and when I would be able to get my money out. I'd probably be putting my money into my own business selling items that would have value in that kind of environment. It you're thinking with a capitalist mindset, this could be a ripe time to build a business.
If a war was on the cards, I think I'd be pulling as much money out of the stock market as I possibly could. War and any sort of disaster are never good for stock markets and investment's, no matter what the brand or product is. That's another reason why the market's can also sometimes be on the verge of collapsing, when something like that occurs, because everybody else will be trying to do the same.