support replacing entries inside a jar

refactor a bit so the logic about replacing xml and properties and be reused for replacing dir or jar