A properly managed compost pile should not smell. My cabbage shows signs of cabbage maggots, especially those most recently planted. There is little that you can do once the plants have been infested. Younger plants are most susceptible and seldom survive. Older plants may outgrow the damage, especially if they have a careful irrigation schedule.
Prevention is the best strategy.
Avoid over fertilizing your soil with manure, which is attractive to female flies that prefer a moist, organic soil for egg-laying.