18 Joshua waged war against all these kings for a long time.

Read Joshua 11:18 Using Other Translations

Joshua made war a long time with all those kings.
Joshua made war a long time with all those kings.
waging war for a long time to accomplish this.