In 1934, in the Italian city of Trieste, Francesco Illy came up with a way to package coffee in pressurized containers that kept it fresh. In 1935, he invented the first automatic coffee machine. In 1974, his company Illy became the first to sell a kind of coffee pod.

Aluminum capsules, the successors of those pods, have become a fiercely contested battleground for the world's biggest coffee companies, notably Nestlé, a Swiss food-and-drink giant, and JAB Holdings, an investment firm intent on building a coffee empire and owner of Brooklyn Center-based Caribou Coffee.

On Oct. 8, in the latest sign that the coffee wars are heating up, Illy signed a licensing deal for capsules with JAB, blending Illy's coffee and cachet with JAB's commercial clout.

Two decades ago as many as 20 substantial companies competed in the retail-coffee trade, said Jeffrey Young of Allegra World Coffee Portal, a consulting firm. In the past few years, the market has consolidated — and at a faster pace in the past year or so.

In 2015, JAB bought Keurig, America's biggest coffee-pod system, for $13.9 billion. It also has swallowed Jacobs Douwe Egberts, Espresso House and Peet's Coffee.

Nestlé signed a $7 billion deal in May with Starbucks to distribute the ubiquitous chain's products.

Today, JAB and Nestlé together control about a third of the market for fresh and instant coffee, which Euromonitor International, a research firm, estimates to be worth $83 billion a year.

While Keurig has controlled the U.S. market — offering a variety of brands and selling them through supermarkets — Nestle's Nespresso leads in Europe. And while the U.S. market has matured, competition in Europe is still bubbling away. And Nestle's 2017 purchase of a majority stake in California's Blue Bottle Coffee is a sign of the company's eagerness to boost its U.S. presence.

Despite JAB's and Nestlé's heft, others are keen to compete. Coca-Cola bought Costa, a British chain, in September for $5 billion.

This month Lavazza, another Italian coffeemaker, bought Mars' coffee business, including its Flavia and Klix vending systems.

But — as for many other products — Amazon is the great unknown.

Sales of hot drinks have been slow to take off online. As capsules' popularity grows that may change, said Matthew Barry of Euromonitor.

Amazon's purchase of Whole Foods, a trendy grocer, in 2017 brought with it Allegro, another fancy coffee brand. A bigger battle may be brewing.