The first sentence should be: "The archeologist has been excavating the caves for many years", and the second: "The archeologist has excavated the caves for many years". Both sentences are right, the only diference is that the first one gives the idea that the archeologist continues excavating (continue doing the excavation) but in the second one, he or she has finished it some time in the recent past. I hope it helps.