I think it was Bruce Laurin who wrote (or he penned words to this effect): "not everything that happens in the word of God is the will of God." From what I recall, he was talking about the "holy war" that occurs in the Hebrew Bible. Yes, there is war in the Tanakh: people are slaughtered, hacked, and run through. However, I believe that Laurin has a point. For while some of the "violence" in the Hebrew Bible was certainly said to be sanctioned by YHWH (Jehovah), not all of it was. There is also a question about how we should define violence or categorize it. For example, is all violence morally objectionable? Furthermore, what counts as violence?
Another way I want to address the violence in the Hebrew Bible is to distinguish between prescription and description: much of what I find in the Tanakh is a description of how imperfect humans acted as they rebelled against the dictates of God, not a prescription to commit violence. In fact, Psalm 11:5 condemns the person who loves violence and says that YHWH "hates" such an individual. Another consideration is that even when YHWH used Israel or other nations for the cause of war, God set limits, which limits imperfect humans transgressed.
The accounts of holy war are part of the Bible's candor; Scripture may utilize euphemisms at times but it likewise supplies very open accounts that honestly lay bare human iniquity. On the other hand, the justice of God can be severe and Scripture doesn't hide that fact either. See Hebrews 10:26-31.
In the spirit of 2 Timothy 3:16-17, I believe we can learn many lessons from the accounts of war found in the Hebrew Bible.
The McClintock and Strong Biblical Cyclopedia contains some interesting remarks under its entry for "war":
It has been questioned whether wars are, under any circumstances, justifiable from Jewish example. While it is certain that the practice of offensive' wars cannot be defended by reference to sacred history, it is equally clear, if wars must be, that they can only be consistent with the light of that dispensation which breathes forgiveness and forbearance on the clear and obvious ground of necessity and self-defense. When the principles of the Bible shall have illuminated the minds of all nations, wars shall cease from the ends of the earth, and all men will give glory to God in the highest, and on earth peace and good-will will universally prevail (Ps 46:9; Ps 76:3; Isa 2:4; Eze 39:9; Lu 2:14).