return services.get().getMetaModelProvider();
}
private void addProcessorPlugin(MetaModelProvider provider)
{
MavenPluginFacet facet = getFaceted().getFacet(MavenPluginFacet.class);
CoordinateBuilder processorDependency = createProcessorCoordinate();
if (facet.hasPlugin(processorDependency))
{
return;
}
Coordinate versioned = getLatestVersion(processorDependency);
ConfigurationBuilder configuration = ConfigurationBuilder.create();
configuration.createConfigurationElement("processors")
.addChild("processor").setText(provider.getProcessor());
if (!Strings.isNullOrEmpty(provider.getCompilerArguments()))
{
configuration.createConfigurationElement("compilerArguments")
.setText(provider.getCompilerArguments());
}
ExecutionBuilder execution = ExecutionBuilder.create()
.setId("process")
.setPhase("generate-sources")
.addGoal("process")
.setConfig(configuration);
Coordinate aptDependency = provider.getAptCoordinate();
if (Strings.isNullOrEmpty(aptDependency.getVersion()))
{
aptDependency = getLatestVersion(aptDependency);
}
final MavenPlugin processorPlugin = MavenPluginBuilder.create()
.setCoordinate(versioned)
.addExecution(execution)
.addPluginDependency(DependencyBuilder.create().setCoordinate(aptDependency));
facet.addPlugin(processorPlugin);
// FORGE-700
getFaceted().getFacet(DependencyFacet.class).addDirectDependency(
DependencyBuilder.create().setCoordinate(aptDependency).setScopeType("provided"));
}