本文整理汇总了Java中org.apache.maven.model.PluginExecution.setGoals方法的典型用法代码示例。如果您正苦于以下问题:Java PluginExecution.setGoals方法的具体用法?Java PluginExecution.setGoals怎么用?Java PluginExecution.setGoals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.model.PluginExecution
的用法示例。
在下文中一共展示了PluginExecution.setGoals方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testMerge_pluginFoundWithNoExecutions
import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
@Test
public void testMerge_pluginFoundWithNoExecutions() {
Plugin buildPlugin = new Plugin();
buildPlugin.setArtifactId("merge-artifact");
List<Plugin> plugins = project.getBuild().getPlugins();
plugins.addAll(dummyPlugins);
plugins.add(buildPlugin);
PluginExecution exec = new PluginExecution();
exec.setId("merge-execution-id");
exec.setGoals(Arrays.asList("some-goal"));
exec.setPhase("random-phase");
exec.setPriority(1);
Plugin mergePlugin = new Plugin();
mergePlugin.setArtifactId("merge-artifact");
mergePlugin.getExecutions().add(exec);
item.merge(project, mergePlugin);
Assert.assertEquals("Plugins.Size", dummyPlugins.size() + 1, project.getBuildPlugins().size());
for (int i = 0; i < dummyPlugins.size(); i++) {
Assert.assertThat("Plugins["+i+"]", project.getBuildPlugins().get(i), Matchers.sameBeanAs(dummyPlugins.get(i)));
}
Assert.assertThat("Plugins["+dummyPlugins.size()+"]", project.getBuildPlugins().get(dummyPlugins.size()), Matchers.sameBeanAs(mergePlugin));
}
示例2: getJavadocPlugin
import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
private static Plugin getJavadocPlugin() {
final Plugin javadocPlugin = new Plugin();
javadocPlugin.setGroupId("org.apache.maven.plugins");
javadocPlugin.setArtifactId("maven-javadoc-plugin");
//javadocPlugin.setVersion("2.10.4");
PluginExecution pluginExecution = new PluginExecution();
pluginExecution.setId("javadoc");
List<String> goals = new ArrayList<>();
goals.add("jar");
pluginExecution.setGoals(goals);
pluginExecution.setPhase("package");
List<PluginExecution> pluginExecutions = new ArrayList<>();
pluginExecutions.add(pluginExecution);
javadocPlugin.setExecutions(pluginExecutions);
final Xpp3Dom javadocConfig = new Xpp3Dom("configuration");
final Xpp3Dom quiet = new Xpp3Dom("quiet");
quiet.setValue("true");
javadocConfig.addChild(quiet);
javadocPlugin.setConfiguration(javadocConfig);
return javadocPlugin;
}
示例3: getSourcePlugin
import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
private static Plugin getSourcePlugin() {
final Plugin sourcePlugin = new Plugin();
sourcePlugin.setGroupId("org.apache.maven.plugins");
sourcePlugin.setArtifactId("maven-source-plugin");
PluginExecution pluginExecution = new PluginExecution();
pluginExecution.setId("attach-sources");
List<String> goals = new ArrayList<>();
goals.add("jar");
pluginExecution.setGoals(goals);
pluginExecution.setPhase("package");
List<PluginExecution> pluginExecutions = new ArrayList<>();
pluginExecutions.add(pluginExecution);
sourcePlugin.setExecutions(pluginExecutions);
return sourcePlugin;
}
示例4: mergePluginExecution_Goals
import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
@Override
protected void mergePluginExecution_Goals( PluginExecution target, PluginExecution source, boolean sourceDominant,
Map<Object, Object> context )
{
List<String> src = source.getGoals();
if ( !src.isEmpty() )
{
List<String> tgt = target.getGoals();
Set<String> excludes = new LinkedHashSet<String>( tgt );
List<String> merged = new ArrayList<String>( tgt.size() + src.size() );
merged.addAll( tgt );
for ( String s : src )
{
if ( !excludes.contains( s ) )
{
merged.add( s );
}
}
target.setGoals( merged );
}
}
示例5: getNewCompilerPlugin
import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
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;
}
示例6: testMerge_pluginFoundWithExecutions
import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
@Test
public void testMerge_pluginFoundWithExecutions() {
PluginExecution buildExec = new PluginExecution();
buildExec.setId("random-execution-id");
buildExec.setGoals(Arrays.asList("some-goal"));
buildExec.setPhase("random-phase");
buildExec.setPriority(1);
Plugin buildPlugin = new Plugin();
buildPlugin.setArtifactId("merge-artifact");
buildPlugin.addExecution(buildExec);
List<Plugin> plugins = project.getBuild().getPlugins();
plugins.addAll(dummyPlugins);
plugins.add(buildPlugin);
PluginExecution mergeExec = new PluginExecution();
mergeExec.setId("merge-execution-id");
mergeExec.setGoals(Arrays.asList("some-goal"));
mergeExec.setPhase("random-phase");
mergeExec.setPriority(1);
Plugin mergePlugin = new Plugin();
mergePlugin.setArtifactId("merge-artifact");
mergePlugin.getExecutions().add(mergeExec);
item.merge(project, mergePlugin);
Plugin expectedPlugin = new Plugin();
expectedPlugin.setArtifactId("merge-artifact");
expectedPlugin.getExecutions().add(buildExec);
expectedPlugin.getExecutions().add(mergeExec);
Assert.assertEquals("Plugins.Size", dummyPlugins.size() + 1, project.getBuildPlugins().size());
for (int i = 0; i < dummyPlugins.size(); i++) {
Assert.assertThat("Plugins["+i+"]", project.getBuildPlugins().get(i), Matchers.sameBeanAs(dummyPlugins.get(i)));
}
Assert.assertThat("Plugins["+dummyPlugins.size()+"]", project.getBuildPlugins().get(dummyPlugins.size()), Matchers.sameBeanAs(expectedPlugin));
}
示例7: testMerge_pluginFoundWithConflictingExecutions
import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
@Test
public void testMerge_pluginFoundWithConflictingExecutions() {
PluginExecution buildExec = new PluginExecution();
buildExec.setId("merge-execution-id");
buildExec.setGoals(Arrays.asList("original-goal"));
buildExec.setPhase("original-phase");
buildExec.setPriority(1);
Plugin buildPlugin = new Plugin();
buildPlugin.setArtifactId("merge-artifact");
buildPlugin.addExecution(buildExec);
List<Plugin> plugins = project.getBuild().getPlugins();
plugins.addAll(dummyPlugins);
plugins.add(buildPlugin);
PluginExecution mergeExec = new PluginExecution();
mergeExec.setId("merge-execution-id");
mergeExec.setGoals(Arrays.asList("merge-goal"));
mergeExec.setPhase("merge-phase");
mergeExec.setPriority(2);
Plugin mergePlugin = new Plugin();
mergePlugin.setArtifactId("merge-artifact");
mergePlugin.getExecutions().add(mergeExec);
item.merge(project, mergePlugin);
Plugin expectedPlugin = new Plugin();
expectedPlugin.setArtifactId("merge-artifact");
expectedPlugin.getExecutions().add(buildExec);
Assert.assertEquals("Plugins.Size", dummyPlugins.size() + 1, project.getBuildPlugins().size());
for (int i = 0; i < dummyPlugins.size(); i++) {
Assert.assertThat("Plugins["+i+"]", project.getBuildPlugins().get(i), Matchers.sameBeanAs(dummyPlugins.get(i)));
}
Assert.assertThat("Plugins["+dummyPlugins.size()+"]", project.getBuildPlugins().get(dummyPlugins.size()), Matchers.sameBeanAs(expectedPlugin));
}
示例8: clone
import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
private PluginExecution clone(PluginExecution execution) {
PluginExecution clonedExecution = new PluginExecution();
clonedExecution.setId(execution.getId() + "-snapshot");
clonedExecution.setGoals(execution.getGoals());
clonedExecution.setPhase(execution.getPhase());
clonedExecution.setPriority(execution.getPriority());
return clonedExecution;
}
示例9: mergePluginExecutionDefinitions
import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
private static void mergePluginExecutionDefinitions( PluginExecution child, PluginExecution parent )
{
if ( child.getPhase() == null )
{
child.setPhase( parent.getPhase() );
}
List<String> parentGoals = parent.getGoals();
List<String> childGoals = child.getGoals();
List<String> goals = new ArrayList<String>();
if ( ( childGoals != null ) && !childGoals.isEmpty() )
{
goals.addAll( childGoals );
}
if ( parentGoals != null )
{
for ( String goal : parentGoals )
{
if ( !goals.contains( goal ) )
{
goals.add( goal );
}
}
}
child.setGoals( goals );
Xpp3Dom childConfiguration = (Xpp3Dom) child.getConfiguration();
Xpp3Dom parentConfiguration = (Xpp3Dom) parent.getConfiguration();
childConfiguration = Xpp3Dom.mergeXpp3Dom( childConfiguration, parentConfiguration );
child.setConfiguration( childConfiguration );
}
示例10: mergePluginExecution_Goals
import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
protected void mergePluginExecution_Goals( PluginExecution target, PluginExecution source, boolean sourceDominant,
Map<Object, Object> context )
{
List<String> src = source.getGoals();
if ( !src.isEmpty() )
{
List<String> tgt = target.getGoals();
List<String> merged = new ArrayList<String>( tgt.size() + src.size() );
merged.addAll( tgt );
merged.addAll( src );
target.setGoals( merged );
}
}