Early wars with AIs only suck if you're not ready and are on the receiving end of the invasion. I like to take it to the AIs early when possible since you can gain some nice cities that way and jumpstart your civ.
Gufnork said:
The best way to avoid early wars is to have a powerful military.
Yup. Most AIs will attack if you're weak, especially if they "request" stuff and you don't give in, and/or if you have bad relations due to religion, lack of open borders, etc. You could even be attacked by friendly civs if you're really weak and they can easily gain (your lands). Over time aggressive AIs tend to fight more wars so you always have to be careful if they border you. And always remember that diplomacy is about more than simply your relation with the AIs - their relations amongst each other are important too. I'm sure most of us have asked/bribed one AI to attack another. Well, they can do the same to you - one can get another to attack you even if you're not hating each other.
Ideally you hookup copper or iron early and get an archer, axeman, and spearman in every border city asap so you have defenders for all types of attackers and a decent military presence in general (also a good idea to protect against barbarians on many map types). Then get some chariots or horse archers ready to help counter pillagers. AIs love to pillage so simply having adequate city defense isn't enough - you need to be ready to (counter)attack in some capacity or you're at risk of being crippled by pillaging while your defenders watch from the protection of your cities.
I'll often create one or more semi-centrally located "reaction teams" of mounted/whatever troops who can reach my border areas so that I don't have to overload every single city with defenders. Sometimes the AIs attack thinking I'm weak due to a lower number of units but they're well organized units ready to repel invaders (and not just sit in cities and watch).
Obviously as the game goes on AIs will bring it with bigger and bigger armies, so scale your defenses appropriately. AIs get cheaper unit upgrades so you have to be weary of your defenders getting obsolete too.
This whole concept is something that I think is much improved in Civ IV (over Civ3) as you have to diversify your defenses more, diplomacy and attack tendencies of the AIs are more reasonable, and there's more to balancing infrastructure and defending than simply pumping out a couple of spearmen at every city.