XWIKI-7163: Resolving of an extension artifact from a maven repository seems to cause unexpected persistence of its POM information
* refactor a bit

(cherry picked from commit 2420ae7210e27928af00896009aa63a0f78c8379)