Trade flourished in Gniezno, four large annual fairs took place, in which merchants from various Polish cities and European countries took part. Crafts also developed, and Gniezno remained one of the major cities of Poland until the mid-17th century, even despite fires of 1515 and 1613. It was devastated during the Swedish invasion wars of the 17th–18th centuries and by a plague in 1708–1710. All this caused depopulation and economic decline, but the city was soon revived during the 18th century to become the capital of the Gniezno Voivodeship within the larger Greater Poland Province of the Polish Crown in 1768. Gniezno remained one of the main cultural centeres of the Polish Kingdom. Gniezno was annexed by the Kingdom of Prussia in the 1793 Second Partition of Poland and renamed "Gnesen", becoming part of the province of South Prussia. During the Kościuszko Uprising, the Polish army under General Jan Henryk Dąbrowski liberated the town on 22 August 1794 and defeated a Prussian Army north of Gnesen near Labischin (Łabiszyn) on 29 September 1794. But because of Kościuszko's defeat at the Battle of Maciejowice he gave up his plan to winter in Bromberg (Bydgoszcz) and moved through Thorn (Toruń) and retreated to central Poland. Thus, the Prussians retook it on 7 December 1794. During the Napoleonic Wars there was an uprising against Prussian rule. The French appeared in Gnesen in November 1806, and following General Jan Henryk Dabrowski's order issued to all towns and cities and country property owners to provide recruits for the organizing Polish forces, Gnesen initially provided 60 recruits who participated in the battles of 1806–07. Consequently, the town was included within the Duchy of Warsaw, but upon the defeat of Napoleon in Russia in 1812 it was occupied by the Russian army and was returned to Prussia in the 1815 Congress of Vienna. Gnesen was subsequently governed within Kreis Gnesen of the Grand Duchy of Posen and the later Province of Posen. It was an important center of Polish resistance against Germanisation policies, various Polish organizations and publishing houses were located there. Following the Greater Poland Uprising (1918–1919) and the Treaty of Versailles the town became part of the Second Polish Republic and reverted to its original name of Gniezno.