It's historically uncommon that a central government will ever mass produce weapons themselves, whether in the modern era or the more distant past. It would be a worthwhile spin-off question to ask for historical examples of this occurring. For example, the Roman Empire in its quest to standardize weapons and equipment for the legions tasked some immunes (non-combat soldiers) to manufacture armor and gladii and so on. Likewise, the medieval Venetian Arsenal was operated by the republic to produce galleys with extreme efficiency, up to a ship a day (which is impressive for any period).
But I digress. Just as the current US Congress contracts out orders for fighter jets from Lockheed Martin, and Germany during the world wars relied on Krupp industries, early modern leaders generally relied on entrepreneurial contractors for all their warfare needs. And these needs were on a massive scale- 16th-18th century monarchies have been accurately labeled 'fiscal-military states', as the majority of state expenditures tended to go towards the military, even in periods of peace. Even the recruitment of soldiers was essentially contracted out to the leaders of regiments, who gathered men and equipped them while being paid by the state for each soldier under his command (Albrecht von Wallenstein during the 30 Years' War being perhaps the most famous and wealthy example of an entrepreneur general). OP picked an interesting century to ask about, as during the 18th century the more absolutist states of France and Spain gradually took on a more direct role in the production of war materiel, while the expansion of industry in less absolutist states such as Britain and the Netherlands brought about capitalist competition that was beneficial to the purchaser states.
Privileges and monopolies were granted to companies as part of contracts- which tended to develop that particular manufacturer very quickly and allowed for easier standardization, but at the cost of denying capitalist competition among suppliers. For example Charles III of Spain decided to stop relying on French contractors to supply uniforms for his army, and so contracted in 1763 a Barcelona textile company to produce almost all of the uniforms for the Spanish army, a monopoly that company held for several decades. Philip V had granted similar privileges to arms companies earlier that century, choosing to favor entrepreneurs from the north over having to import weapons from abroad. Manufactories in the Basque country had long produced firearms (so many that the town of Placencia added "de las Armas" to its name) for the Habsburgs and they continued to do so under the Bourbons. Likewise, royal privileges towards the Babaud family business in France grew the company from a small timber wholesaler into the Forges Royales, which supplied most of the iron fixings needed for the both the French navy and the French East India Company (especially anchors). Ultimately, the company was purchased by Louis XVI in 1781 to keep it intact when the owner fell into financial troubles.
Britain and the Netherlands, on the other hand, relied on a very decentralized market to produce their weapons. The Low Countries was filled with artisan workshops, which might specialize in crafting particular parts of muskets while another workshop would later put the pieces together. Then the weapons could be sold on a free market which included government contractors. This ensured the survival of such workshops when the state had a lower need for weapons as they could easily sell them to someone else, and the flexible nature of this industry allowed for faster incorporation of new weapons technologies such as using better steel. Britain was supplied muskets in a similar manner largely from workshops near Birmingham.