Taiwan has detained an army officer and several collaborators on suspicion of handing military secrets to China.