Internationalists have been fighting for over 4 decades to protect children from becoming soldiers. There have been many court cases and laws enacted to prevent exploitation of children.
Laws have prohibits military recruitment for people under 15, and the International Criminal Court now recognizes breaking this law as a war crime.
OPAC (Optional Protocol to the Convention on the Rights of the Child) focuses on ending children soldiers. This treaty prohibits recruiting anyone under the age of 18, or even asking them to engage in any hostile activities.
Many states have signed OPAC, and other international laws are helping in this effort, such as the International Labour Organization and the African Union's Charter on the Rights and Welfare of the Child.