The build up of one's military and weapons is called militarism. Countries often adapt this policy if they feel the need to defend themselves, e.g. in the foresight of a war.
Germany belonged to the Triple Alliance, siding with Austria-Hungary and Italy during WWI.
When Archduke Franz Ferdinand was assassinated at Sarajevo in 1914, Serbia was blamed as it was a young Serbian nationalist - Gravilo Princip - that carried out the murder.