There are plenty of techniques the military could use to make jamming or spoofing almost impossible.
For example, use a signal encrypted with a key not known to the enemy. That prevents spoofing.
Jamming can be pretty much eliminated by using phased array antennas. They can reject signals coming from the wrong direction. To fully block a military unit receiving GPS, the enemy would need to have ~30 planes in the sky over the unit, between the unit and each GPS satellite, broadcasting the jamming signal. Pretty infeasible for them.
There are other ways to make jamming far far harder. For example, if you are happy for your GPS receiver to be always on and have an atomic clock, you can make a new signal that replaces the 1024 bit PRN codes with multi-gigabyte codes which are secret. That effectively means rather than the enemy needing to overpower the real signal, the enemy needs to be billions of times stronger than the real signal to prevent you decoding it.
For example, use a signal encrypted with a key not known to the enemy. That prevents spoofing.
Jamming can be pretty much eliminated by using phased array antennas. They can reject signals coming from the wrong direction. To fully block a military unit receiving GPS, the enemy would need to have ~30 planes in the sky over the unit, between the unit and each GPS satellite, broadcasting the jamming signal. Pretty infeasible for them.
There are other ways to make jamming far far harder. For example, if you are happy for your GPS receiver to be always on and have an atomic clock, you can make a new signal that replaces the 1024 bit PRN codes with multi-gigabyte codes which are secret. That effectively means rather than the enemy needing to overpower the real signal, the enemy needs to be billions of times stronger than the real signal to prevent you decoding it.