Plants evolved many complex chemicals as defences against herbivores. That may be the origin of these resins, which are certainly not good to eat. Plants secrete resins for their protective benefits in response to injury. 