Trim root end of each onion and cut an X in it. Blanch in boiling water 1 minute, then drain in a colander. Cool slightly, then peel. Bring juice, sugar, vinegar, and spices to a boil in a 3-quart heavy saucepan, stirring until sugar has dissolved. Add onions and quinces and simmer, uncovered, stirring occasionally, until tender but not falling apart, about 30 minutes. Add cranberries and simmer until tender but not falling apart, 5 to 8 minutes. Discard cloves. Transfer fruit and onions to a bowl using a slotted spoon, then boil syrup, if necessary, until reduced to 1/2 cup. Pour syrup over compote and cool to room temperature.