configureMojo(mojo, new FileInputStream(pom));
return mojo;
}
private void configureMojo(Object mojo, InputStream is) throws Exception {
ComponentConfigurator configurator = new BasicComponentConfigurator();
ExpressionEvaluator evaluator = new DefaultExpressionEvaluator();
Xpp3Dom dom = Xpp3DomBuilder.build(is, "UTF-8")
.getChild("build")
.getChild("plugins")
.getChild("plugin")
.getChild("configuration");
PlexusConfiguration config = new XmlPlexusConfiguration(dom);
ClassRealm realm = new ClassWorld()
.newRealm(null, getClass().getClassLoader());
configurator.configureComponent(mojo, config, evaluator, realm);
}