It sounds like an idea for a science fiction film, but here in the UK scientists and engineers are spending time and money to see if they can do exactly that.
British warplanes are already flying with parts made from a 3D printer. Researchers are already using that same technology to build drones.
The military advantage is obvious - building equipment quickly and close to the battlefield - without long waits and long supply chains - gives you an enormous advantage over any enemy.