The primary advantage of a 3D printer is the ability to make complex shapes and forms more quickly and easily than conventional forms of production (casting, milling, forging etc.). Firearms and hand grenades are designed and manufactured in such a fashion that 3D printing does not provide any appreciable advantage over steel stampings,pressing and spot welding, and as noted, a barrel requires high strength material to operate reliably for a prolonged period.
The second issue is that for many items, 3D printing still requires assembly. If your device has parts made of metal, plastic and ceramics, each individual piece must be printed and then assembled (This is making the big assumption that the printer can deal with each type of material. More likely you need separate printers for each material). Even if all the parts are of the same material, a working device is not monolithic, so individual parts like the barrel, bolt, receiver etc. still need to be made separately and then assembled.
Finally, ignoring the issue of providing energy to the printer in the field, you need raw materials in order to print. While you might need less raw materials because there is less waste from machining etc., if your rifle weighs 3 kg unloaded, you need at least 3 kg of raw materials. A solider wandering around in the field with a printer, multiple bags of powdered raw materials an a portable hard drive with the templates of every conceivable device he might need to print will be more burdened than a soldier armed and equipped in a conventional manner, and most of what the 3D soldier is carrying won't be immediately useful anyway, until it gets printed.
Printers do have a place in a logistics chain, especially where you need access to lots of complex parts and have limited storage space. The maintenance hanger on an aircraft carrier is a good example. Being isolated and at the end of a long supply chain is another example, the ISS is an extreme example, and future "space navies" will have their ships outfitted with fully evolved examples of 3D printers. 3D printers have a place in the military, but not on the front lines.