Your problem seems to be caused by outdated Maven version on your Jenkins.
maven-versions-plugin
uses JSR-330 for dependency injection, see for example none-recorder or xml-recorder sources:
@javax.inject.Named("none")
public class ChangeRecorderNull implements ChangeRecorder {
@javax.inject.Named("xml")
public class ChangeRecorderXML implements ChangeRecorder {
But in JSR-330 documentation explicitly said:
If you want to use JSR-330, you must understand that your code won't be compatible with Maven 3.0.x but only with Maven 3.1.0 and later. Even though JSR-330 has been available in core since Maven 3.0-beta-3, it was made available to plugins and extensions only in Maven 3.1.0 (see MNG-5343 for more details).
When @Named
injection does NOT work you should see symptoms like in your case:
public abstract class AbstractVersionsUpdaterMojo extends AbstractMojo {
...
@Inject
protected AbstractVersionsUpdaterMojo(
RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
Map<String, Wagon> wagonMap,
Map<String, ChangeRecorder> changeRecorders // <<<< EMPTY MAP INJECTED FOR MAVEN < 3.1
) {
this.repositorySystem = repositorySystem;
this.aetherRepositorySystem = aetherRepositorySystem;
this.wagonMap = wagonMap;
this.changeRecorders = changeRecorders;
}
...
protected ChangeRecorder getChangeRecorder() throws MojoExecutionException {
ChangeRecorder changeRecorder = changeRecorders.get(changeRecorderFormat);
if (changeRecorder == null) {
throw new MojoExecutionException(
"Only " + changeRecorders.keySet() + " formats are supported for change recordings");
}
return changeRecorder;
}
I highly recommend to use Maven Wrapper to keep consistent builds across different environments.