I would evade or serve based on which I thought would best advance the class struggle.
Marxist rhetoric aside, I hope all your answers would be conditional- invading a random country is quite different from the country being invaded.
The country being invaded would not necessarily be a reason to serve in the armed forces, especially if the invading country is invading doing so as an outgrowth of an existing imperial conflict between this country and our hypothetical invader. In that case, it would probably be best to openly organize a third camp to repel the invaders
and take advantage of the weakened state of the capitalists in order to seize power domestically. Essentially the opposite of what the CNT-FAI and POUM did in Spain. Collaborating with the state when revolutionary possibilities exist is to act as a handmaid of reaction.