use of org.apache.maven.model.Plugin in project docker-maven-plugin by fabric8io.
the class MojoExecutionServiceTest method noDescriptor.
@Test(expected = MojoExecutionException.class)
public void noDescriptor() throws Exception {
new Expectations() {
{
project.getPlugin(PLUGIN_NAME);
result = new Plugin();
pluginDescriptor.getMojo(GOAL_NAME);
result = null;
executionService.getPluginDescriptor((MavenProject) any, (Plugin) any);
}
};
executionService.callPluginGoal(PLUGIN_NAME + ":" + GOAL_NAME);
new Verifications() {
{
}
};
}
use of org.apache.maven.model.Plugin in project kie-wb-common by kiegroup.
the class MavenAPIUtil method getPlugin.
public static Plugin getPlugin(String groupdID, String artifactID, String version) {
Plugin plugin = new Plugin();
plugin.setGroupId(groupdID);
plugin.setArtifactId(artifactID);
plugin.setVersion(version);
return plugin;
}
use of org.apache.maven.model.Plugin 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.Plugin in project kie-wb-common by kiegroup.
the class PomEditor method processKieMavenCompiler.
private void processKieMavenCompiler(List<Plugin> buildPlugins) {
PluginPresence kieMavenCompiler = getPluginPresence(buildPlugins, KIE_PKG, KIE_MAVEN_PLUGIN_ARTIFACT_ID);
if (!kieMavenCompiler.isPresent()) {
buildPlugins.add(getKieMavenPlugin());
} else {
Plugin kieMavenPlugin = buildPlugins.get(kieMavenCompiler.getPosition());
kieMavenPlugin.setVersion(kieVersion);
}
}
use of org.apache.maven.model.Plugin in project kie-wb-common by kiegroup.
the class PomEditor method getPluginPresence.
private PluginPresence getPluginPresence(List<Plugin> plugins, String groupID, String artifactID) {
boolean result = false;
int i = 0;
for (Plugin plugin : plugins) {
if (plugin.getGroupId().equals(groupID) && plugin.getArtifactId().equals(artifactID)) {
result = true;
break;
}
i++;
}
return new PluginPresence(result, i);
}
Aggregations