Verse 18: (Josh. 11:23) Joshua made war a long time with all those kings (till 1445 BC).
[A long time] He adds this so that the confidence due to the history might be greater, and lest anyone that so great wars were finished in the space of a few days. יָמִים/days is used for time, or for years. Josephus, in Jewish Antiquities 5:2, defines this time as five years (Masius). But others, more correctly, as seven years, at least begun. Thus the Jews in Seder Olam (Masius, thus Serarius, Lapide, Bonfrerius, Lyra). Which they prove in this way: Caleb was forty years old when he was sent as a spy from Kadesh-Barnea. But now, when these wars were finished, forty-five years had passed from that time, Joshua 14:7-10, from which, if you subtract thirty-eight years, which after the return of the spies the Israelites spent wandering in the desert, as is gathered from Deuteronomy 2:14, seven years would remain. Thus the Jews calculate, etc., and rightly. (Compare Numbers 33:38 and Deuteronomy 1:3 [Masius].) But, since God was easily able to root out all the Canaanites with a single nod, and to send His people into an empty possession, it is asked why this war was drawn out for such a long time. Responses: 1. The Israelites were to be trained by those long-lasting wars, as by perpetual miracles, and to be exercised in the love of God, and dependence on Him alone, while piety had taken root in their souls through a longer space of time. 2. As the occupation of the land was arduous by the hindrances introduced and the great impediments, so the love of God shines all the more, and His care toward the Church. 3. So that the Israelites might learn to endure in adverse situations, and not to despond because of obstacles. 4. So that the impiety of the Canaanites might be more thoroughly observed, who so obstinately continued to oppose God, who had shown Himself so beneficient toward His worshippers, and so powerful against His enemies. 5. So that there might be a testimony vast mercy of God, He allowed a place for repentance to these, His worst enemies. See Wisdom of Solomon 12:2-10 (Masius).
A long time: For divers years together, as is evident by the following history, and by comparing Deuteronomy 2:14 with Joshua 14:7, etc. And this is here expressed, lest it should be thought that as all these wars are here recorded in a short narration, so they were despatched in a short time. And God would have the land to be conquered gradually, for many weighty reasons: 1. Lest the sudden extirpation of those nations should have made a great part of the land desert, and thereby have increased the numbers of wild beasts, Deuteronomy 7:22. 2. Lest being done suddenly and easily, it should soon be forgotten and despised, as the nature of man is apt to do in those cases. 3. That by long exercise the Israelites might grow skilful in the art of war, which was very useful and needful for them in that land. 4. For the trial and exercise of their patience, and courage, and trust in God. 5. To oblige them to the greater care to please and obey God, whom they yet needed for their help against their enemies.
 Hebrew: יָמִ֣ים רַבִּ֗ים עָשָׂ֧ה יְהוֹשֻׁ֛עַ אֶת־כָּל־הַמְּלָכִ֥ים הָאֵ֖לֶּה מִלְחָמָֽה׃
 Hebrew: יָמִ֣ים רַבִּ֗ים.
 Seder Olam Rabbah was a chronicle from Adam to the Bar Kochba rebellion, written around 160 AD. Tradition ascribes the work to Yose ben Halafta, a Tanna of the fourth generation and student of Rabbi Akiva, but it was probably supplemented and edited by later hands.
 Wisdom of Solomon 12:2-10: “Therefore chastenest thou them by little and little that offend, and warnest them by putting them in remembrance wherein they have offended, that leaving their wickedness they may believe on thee, O Lord. For it was thy will to destroy by the hands of our fathers both those old inhabitants of thy holy land, whom thou hatedst for doing most odious works of witchcrafts, and wicked sacrifices; and also those merciless murderers of children, and devourers of man’s flesh, and the feasts of blood, with their priests out of the midst of their idolatrous crew, and the parents, that killed with their own hands souls destitute of help: that the land, which thou esteemedst above all other, might receive a worthy colony of God’s children. Nevertheless even those thou sparedst as men, and didst send wasps, forerunners of thine host, to destroy them by little and little. Not that thou wast unable to bring the ungodly under the hand of the righteous in battle, or to destroy them at once with cruel beasts, or with one rough word: but executing thy judgments upon them by little and little, thou gavest them place of repentance, not being ignorant that they were a naughty generation, and that their malice was bred in them, and that their cogitation would never be changed.”