private boolean processorConfigured(MetaModelProvider provider) { DependencyBuilder dependency = createProcessorDependency().setVersion(null); MavenPluginFacet pluginFacet = project.getFacet(MavenPluginFacet.class); if (pluginFacet.hasPlugin(dependency)) { MavenPlugin plugin = pluginFacet.getPlugin(dependency); if (plugin.listExecutions().size() > 0) { Configuration config = plugin.listExecutions().get(0).getConfig(); if (config.hasConfigurationElement("processors")) { ConfigurationElement element = config.getConfigurationElement("processors").getChildByName("processor"); return element.getText().equals(provider.getProcessor()); } } } return false; }
private void modifyCompilerPlugin() { Dependency compilerDependency = DependencyBuilder.create() .setGroupId("org.apache.maven.plugins") .setArtifactId("maven-compiler-plugin"); MavenPluginFacet pluginFacet = project.getFacet(MavenPluginFacet.class); MavenPlugin compiler = pluginFacet.getPlugin(compilerDependency); Configuration config = compiler.getConfig(); if (!config.hasConfigurationElement("proc")) { ConfigurationElement proc = ConfigurationBuilder.create().createConfigurationElement("proc").setText("none"); config.addConfigurationElement(proc); ((MavenPluginAdapter)compiler).setConfig(config); } pluginFacet.updatePlugin(compiler); }