I'm not a fan of war, but many technologies and sciences were developed for military use, everything from mathematics for ballistics, food preservation, thermodynamics, antibiotics, nuclear energy, the lunar program, and GPS.
So yes, war is a horrendous waste and terrible detriment to humanity, but even war has had some beneficial side effects.
The same effort can be put into inventing these in the absence of conflict. You do need funding and you do need urgency, but that's a question of national will.
...and war seems to be the most effective source of national will.
Unfortunately, it (often) _isn't_. I'd love to live in that world, but it doesn't seem realistic.