use of org.apache.maven.model.PluginExecution in project kie-wb-common by kiegroup.
the class MavenAPIUtil method disableMavenCompilerAlreadyPresent.
public static void disableMavenCompilerAlreadyPresent(Plugin plugin) {
Xpp3Dom skipMain = new Xpp3Dom(MavenConfig.MAVEN_SKIP_MAIN);
skipMain.setValue(TRUE);
Xpp3Dom skip = new Xpp3Dom(MavenConfig.MAVEN_SKIP);
skip.setValue(TRUE);
Xpp3Dom configuration = new Xpp3Dom(MavenConfig.MAVEN_PLUGIN_CONFIGURATION);
configuration.addChild(skipMain);
configuration.addChild(skip);
plugin.setConfiguration(configuration);
PluginExecution exec = new PluginExecution();
exec.setId(MavenConfig.MAVEN_DEFAULT_COMPILE);
exec.setPhase(MavenConfig.MAVEN_PHASE_NONE);
List<PluginExecution> executions = new ArrayList<>();
executions.add(exec);
plugin.setExecutions(executions);
}
use of org.apache.maven.model.PluginExecution in project kie-wb-common by kiegroup.
the class MavenAPIUtil method getNewCompilerPlugin.
public static Plugin getNewCompilerPlugin(Map<ConfigurationKey, String> conf) {
Plugin newCompilerPlugin = new Plugin();
newCompilerPlugin.setGroupId(conf.get(ConfigurationKey.TAKARI_COMPILER_PLUGIN_GROUP));
newCompilerPlugin.setArtifactId(conf.get(ConfigurationKey.TAKARI_COMPILER_PLUGIN_ARTIFACT));
newCompilerPlugin.setVersion(conf.get(ConfigurationKey.TAKARI_COMPILER_PLUGIN_VERSION));
Xpp3Dom compilerId = new Xpp3Dom(MavenConfig.MAVEN_COMPILER_ID);
compilerId.setValue(conf.get(ConfigurationKey.COMPILER));
Xpp3Dom sourceVersion = new Xpp3Dom(MavenConfig.MAVEN_SOURCE);
sourceVersion.setValue(conf.get(ConfigurationKey.SOURCE_VERSION));
Xpp3Dom targetVersion = new Xpp3Dom(MavenConfig.MAVEN_TARGET);
targetVersion.setValue(conf.get(ConfigurationKey.TARGET_VERSION));
Xpp3Dom failOnError = new Xpp3Dom(MavenConfig.FAIL_ON_ERROR);
failOnError.setValue(conf.get(ConfigurationKey.FAIL_ON_ERROR));
Xpp3Dom configuration = new Xpp3Dom(MavenConfig.MAVEN_PLUGIN_CONFIGURATION);
configuration.addChild(compilerId);
configuration.addChild(sourceVersion);
configuration.addChild(targetVersion);
configuration.addChild(failOnError);
newCompilerPlugin.setConfiguration(configuration);
PluginExecution execution = new PluginExecution();
execution.setId(MavenCLIArgs.DEFAULT_COMPILE);
execution.setGoals(Arrays.asList(MavenCLIArgs.COMPILE));
execution.setPhase(MavenCLIArgs.COMPILE);
newCompilerPlugin.setExecutions(Arrays.asList(execution));
return newCompilerPlugin;
}
use of org.apache.maven.model.PluginExecution in project sling by apache.
the class MavenBundlePluginProjectConfigurator method isSupportingM2eIncrementalBuild.
@Override
protected boolean isSupportingM2eIncrementalBuild(MavenProject mavenProject, Logger logger) {
Plugin bundlePlugin = mavenProject.getPlugin(MAVEN_BUNDLE_PLUGIN_KEY);
if (bundlePlugin == null) {
logger.warn("maven-bundle-plugin not configured!");
return false;
} else {
// check if m2elipse-tycho is already installed (which supports incremental builds for "bundle" packagings
if (LifecycleMappingFactory.createProjectConfigurator(M2E_TYCHO_EXTENSION_PROJECT_CONFIGURATOR_ID) != null) {
logger.trace("Project configurator with id '" + M2E_TYCHO_EXTENSION_PROJECT_CONFIGURATOR_ID + "' found -> m2e-tycho installed.");
return true;
}
String version = bundlePlugin.getVersion();
if (version == null) {
logger.warn("Could not retrieve used version of maven-bundle-plugin!");
return false;
}
ComparableVersion comparableVersion = new ComparableVersion(version);
// with https://issues.apache.org/jira/browse/FELIX-4009 m2e support for incremental builds was added to maven-bundle-plugin in version 3.2.0
if (comparableVersion.compareTo(new ComparableVersion("3.2.0")) >= 0) {
// therefore check configuration
for (PluginExecution pluginExecution : bundlePlugin.getExecutions()) {
if (!pluginExecution.getGoals().contains("manifest")) {
continue;
}
Xpp3Dom configuration = (Xpp3Dom) pluginExecution.getConfiguration();
Xpp3Dom supportIncrementalBuildConfiguration = configuration.getChild("supportIncrementalBuild");
// https://issues.apache.org/jira/browse/FELIX-3324
Xpp3Dom exportScrConfiguration = configuration.getChild("exportScr");
if (supportIncrementalBuildConfiguration == null || !Boolean.parseBoolean(supportIncrementalBuildConfiguration.getValue())) {
logger.warn("Although using maven-bundle-plugin in a version >= 3.2.0, the incremental build support was not enabled.");
} else if (exportScrConfiguration == null || !Boolean.parseBoolean(exportScrConfiguration.getValue())) {
logger.warn("Although using maven-bundle-plugin in a version >= 3.2.0 with incremental build support enabled, component descriptors are not exported (exportScr=false) .");
} else {
logger.trace("Using maven-bundle-plugin in a version >= 3.2.0 with the incremental build support correctly enabled.");
return true;
}
}
} else {
logger.warn("maven-bundle-plugin in a version < 3.2.0 does not natively support incremental builds.");
}
}
return false;
}
use of org.apache.maven.model.PluginExecution in project kie-wb-common by kiegroup.
the class DefaultPomEditor method disableMavenCompilerAlreadyPresent.
protected void disableMavenCompilerAlreadyPresent(Plugin plugin) {
Xpp3Dom skipMain = new Xpp3Dom(MavenConfig.MAVEN_SKIP_MAIN);
skipMain.setValue(TRUE);
Xpp3Dom skip = new Xpp3Dom(MavenConfig.MAVEN_SKIP);
skip.setValue(TRUE);
Xpp3Dom configuration = new Xpp3Dom(MavenConfig.MAVEN_PLUGIN_CONFIGURATION);
configuration.addChild(skipMain);
configuration.addChild(skip);
plugin.setConfiguration(configuration);
PluginExecution exec = new PluginExecution();
exec.setId(MavenConfig.MAVEN_DEFAULT_COMPILE);
exec.setPhase(MavenConfig.MAVEN_PHASE_NONE);
List<PluginExecution> executions = new ArrayList<>();
executions.add(exec);
plugin.setExecutions(executions);
}
use of org.apache.maven.model.PluginExecution in project kie-wb-common by kiegroup.
the class DefaultPomEditor method getNewCompilerPlugin.
protected Plugin getNewCompilerPlugin() {
Plugin newCompilerPlugin = new Plugin();
newCompilerPlugin.setGroupId(conf.get(ConfigurationKey.ALTERNATIVE_COMPILER_PLUGINS));
newCompilerPlugin.setArtifactId(conf.get(ConfigurationKey.ALTERNATIVE_COMPILER_PLUGIN));
newCompilerPlugin.setVersion(conf.get(ConfigurationKey.ALTERNATIVE_COMPILER_PLUGIN_VERSION));
PluginExecution execution = new PluginExecution();
execution.setId(MavenCLIArgs.COMPILE);
execution.setGoals(Arrays.asList(MavenCLIArgs.COMPILE));
execution.setPhase(MavenCLIArgs.COMPILE);
Xpp3Dom compilerId = new Xpp3Dom(MavenConfig.MAVEN_COMPILER_ID);
compilerId.setValue(compiler.name().toLowerCase());
Xpp3Dom configuration = new Xpp3Dom(MavenConfig.MAVEN_PLUGIN_CONFIGURATION);
configuration.addChild(compilerId);
execution.setConfiguration(configuration);
newCompilerPlugin.setExecutions(Arrays.asList(execution));
return newCompilerPlugin;
}
Aggregations