Ported the code from the gradle plugin to the maven plugin