If you're referring to the Texas war for independence from Mexico (1836); certainly Mexico could have avoided war...just let Texas go.
If you're referring to the Mexican War (1846-1848); certainly Mexico could have avoided war...just let California, Arizona, New Mexico, and Nevada go.
War is the obtaining of a political goal by other than political means. Hope this helps! :)