He didn't advocate that even in case of economic troubles. I absolutely agree with the parent. US military spending is one of the major engines that powers the American economy and the American Research University system. Quite contrary to digging ditches and filling them back up, military funding trickles down to fund advanced mathematics, fundamental science and so on: even if indirectly.
While its true that economic growth can be achieved without Keynesian economics, it is hard to sustain economic growth and prosperity at levels that the US has managed to do. While its not all because of the Military, they have had a large (although little acknowledged) hand.
I always get lost on this argument. Americans largely see socialism as evil (obvious consequence of the cold war). Yet, the argument put forward above is essentially arguing for a special form of socialism that applies only to military contractors.
America was founded against the idea of a standing army for almost all its history.
Keynes didn't advocate them at all. He did argue that something like that would be simultaneously be better than the nothing that some others advocated as a government response to a recession in the private sector, and worse than actually investing in (e.g.) useful infrastructure.
Saying that he advocated digging holes and filling them back up is like saying that a person who says that they'd rather have their arm ripped off than be decapitated is begging to be dismembered.
He didn't advocate digging holes and filling them back up as a normal thing - he advocated it only in rare cases of economic troubles.