当前位置: 首页>>代码示例>>Java>>正文


Java Plugin.setArtifactId方法代码示例

本文整理汇总了Java中org.apache.maven.model.Plugin.setArtifactId方法的典型用法代码示例。如果您正苦于以下问题:Java Plugin.setArtifactId方法的具体用法?Java Plugin.setArtifactId怎么用?Java Plugin.setArtifactId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.maven.model.Plugin的用法示例。


在下文中一共展示了Plugin.setArtifactId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createPlugin

import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
protected Plugin createPlugin(String groupId, String artifactId, String version, String configuration,
		String executionId, String goal, String phase) throws MavenExecutionException {
	Plugin plugin = new Plugin();
	plugin.setGroupId(groupId);
	plugin.setArtifactId(artifactId);
	plugin.setVersion(version);

	PluginExecution execution = new PluginExecution();
	execution.setId(executionId);
	execution.addGoal(goal);
	if (phase != null) {
		execution.setPhase(phase);
	}
	if (configuration != null) {
		execution.setConfiguration(mavenConfig.asXpp3Dom(configuration));
	}
	plugin.addExecution(execution);

	return plugin;
}
 
开发者ID:commsen,项目名称:EM,代码行数:21,代码来源:DynamicMavenPlugin.java

示例2: addPluginWithVersionTest

import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
@Test
public void addPluginWithVersionTest() throws IOException, XmlPullParserException {
	Model pomModelBeforeChange = getOriginalPomModel("pom.xml");
	assertEquals(pomModelBeforeChange.getBuild().getPlugins().size(), 1);
	assertEquals(pomModelBeforeChange.getBuild().getPlugins().get(0).getGroupId(), "org.codehaus.mojo");
	assertEquals(pomModelBeforeChange.getBuild().getPlugins().get(0).getArtifactId(), "cobertura-maven-plugin");

       PomAddPlugin pomAddPlugin = new PomAddPlugin("org.apache.maven.plugins", "maven-javadoc-plugin", "2.10.4").relative("pom.xml");
	TOExecutionResult executionResult = pomAddPlugin.execution(transformedAppFolder, transformationContext);
	assertEquals(executionResult.getType(), TOExecutionResult.Type.SUCCESS);

	Model pomModelAfterChange = getTransformedPomModel("pom.xml");
	assertEquals(pomModelAfterChange.getBuild().getPlugins().size(), 2);
       Plugin plugin = new Plugin();
       plugin.setGroupId("org.apache.maven.plugins");
       plugin.setArtifactId("maven-javadoc-plugin");
       assertTrue(pomModelAfterChange.getBuild().getPlugins().contains(plugin));
       assertEquals(pomModelAfterChange.getBuild().getPluginsAsMap().get("org.apache.maven.plugins:maven-javadoc-plugin").getVersion(), "2.10.4");
}
 
开发者ID:paypal,项目名称:butterfly,代码行数:20,代码来源:PomAddPluginTest.java

示例3: addPluginWithoutVersionTest

import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
@Test
public void addPluginWithoutVersionTest() throws IOException, XmlPullParserException {
    Model pomModelBeforeChange = getOriginalPomModel("pom.xml");
    assertEquals(pomModelBeforeChange.getBuild().getPlugins().size(), 1);
    assertEquals(pomModelBeforeChange.getBuild().getPlugins().get(0).getGroupId(), "org.codehaus.mojo");
    assertEquals(pomModelBeforeChange.getBuild().getPlugins().get(0).getArtifactId(), "cobertura-maven-plugin");

    PomAddPlugin pomAddPlugin = new PomAddPlugin("org.apache.maven.plugins", "maven-javadoc-plugin").relative("pom.xml");
    TOExecutionResult executionResult = pomAddPlugin.execution(transformedAppFolder, transformationContext);
    assertEquals(executionResult.getType(), TOExecutionResult.Type.SUCCESS);

    Model pomModelAfterChange = getTransformedPomModel("pom.xml");
    assertEquals(pomModelAfterChange.getBuild().getPlugins().size(), 2);
    Plugin plugin = new Plugin();
    plugin.setGroupId("org.apache.maven.plugins");
    plugin.setArtifactId("maven-javadoc-plugin");
    assertTrue(pomModelAfterChange.getBuild().getPlugins().contains(plugin));
    assertNull(pomModelAfterChange.getBuild().getPluginsAsMap().get("org.apache.maven.plugins:maven-javadoc-plugin").getVersion());
}
 
开发者ID:paypal,项目名称:butterfly,代码行数:20,代码来源:PomAddPluginTest.java

示例4: getEnforcerPlugin

import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
public Plugin getEnforcerPlugin(MavenProject project)
        throws MavenExecutionException {
    StringBuilder configString = new StringBuilder()
            .append("<configuration><rules>")
            .append("<requireReleaseDeps><message>No Snapshots Allowed!</message><excludes><exclude>"+project.getGroupId()+":*</exclude></excludes></requireReleaseDeps>")
            .append("</rules></configuration>");
    Xpp3Dom config = null;
    try {
        config = Xpp3DomBuilder.build(new StringReader(configString.toString()));
    } catch (XmlPullParserException | IOException ex) {
        throw new MavenExecutionException("Issue creating cofig for enforcer plugin", ex);
    }

    PluginExecution execution = new PluginExecution();
    execution.setId("no-snapshot-deps");
    execution.addGoal("enforce");
    execution.setConfiguration(config);

    Plugin result = new Plugin();
    result.setArtifactId("maven-enforcer-plugin");
    result.setVersion("1.4.1");
    result.addExecution(execution);

    return result;
}
 
开发者ID:IG-Group,项目名称:cdversion-maven-extension,代码行数:26,代码来源:Plugins.java

示例5: testMerge_pluginFoundWithNoExecutions

import org.apache.maven.model.Plugin; //导入方法依赖的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));
}
 
开发者ID:IG-Group,项目名称:cdversion-maven-extension,代码行数:27,代码来源:PluginMergerTest.java

示例6: getOrCreateResourcesPlugin

import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
private static Plugin getOrCreateResourcesPlugin(Model mavenModel) {

		Build build = getOrCreateBuild(mavenModel);

		// Locate the plugin and returns if exists
		for (Iterator<Plugin> iterator = build.getPlugins().iterator(); iterator.hasNext();) {
			Plugin next = iterator.next();
			if ("maven-resources-plugin".equals(next.getArtifactId())) {
				return next;
			}
		}

		// Creates if couldn't be found.
		Plugin resourcesPlugin = new Plugin();
		resourcesPlugin.setGroupId("org.apache.maven.plugins");
		resourcesPlugin.setArtifactId("maven-resources-plugin");
		resourcesPlugin.setVersion("${maven.resources.plugin.version}");
		build.getPlugins().add(resourcesPlugin);
		return resourcesPlugin;
	}
 
开发者ID:awltech,项目名称:eclipse-asciidoctools,代码行数:21,代码来源:MavenEnablerJob.java

示例7: getJavadocPlugin

import org.apache.maven.model.Plugin; //导入方法依赖的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;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-stream-app-maven-plugin,代码行数:25,代码来源:MavenModelUtils.java

示例8: getSourcePlugin

import org.apache.maven.model.Plugin; //导入方法依赖的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;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-stream-app-maven-plugin,代码行数:18,代码来源:MavenModelUtils.java

示例9: setupArtifact

import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
@SuppressWarnings( "unchecked" )
void setupArtifact( String groupId, String artifactId, String goal, String type )
      throws DuplicateMojoDescriptorException, PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, InvalidPluginDescriptorException {

   DefaultArtifact artifact = new DefaultArtifact( groupId, artifactId, "DUMMY", "compile", type, "", null );
   MojoDescriptor mojoDescriptor = new MojoDescriptor();
   mojoDescriptor.setGoal( goal );
   PluginDescriptor pluginDescriptor = new PluginDescriptor();
   pluginDescriptor.addMojo( mojoDescriptor );

   Plugin plugin = new Plugin();
   plugin.setGroupId( groupId );
   plugin.setArtifactId( artifactId );

   when( this.mojo.pluginManager.loadPlugin( eq( plugin ), anyList(), any( RepositorySystemSession.class ) ) ).thenReturn( pluginDescriptor );

   this.mojo.pluginDescriptor.getArtifactMap().put( String.format( "%s:%s", groupId, artifactId ), artifact );
}
 
开发者ID:ZsZs,项目名称:FitNesseLauncher,代码行数:19,代码来源:SetupsMojoTestHelper.java

示例10: addPluginExecutions

import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
private void addPluginExecutions(MavenProject project) throws MavenExecutionException {
	Properties properties = new Properties();
	try {
		properties.load(this.getClass().getResourceAsStream("version.properties"));
	} catch (IOException e) {
		throw new MavenExecutionException("Could not read plugin properties", e);
	}
	Plugin plugin = new Plugin();
	plugin.setGroupId(properties.getProperty("groupId"));
	plugin.setArtifactId(properties.getProperty("artifactId"));
	plugin.setVersion(properties.getProperty("version"));
	addPluginExecution(plugin, "compile", Phase.GENERATE_SOURCES);
	addPluginExecution(plugin, "compile", Phase.PRE_SITE);
	Phase[] lifecyclePhases = Phase.values();
	for (int i = 0; i < lifecyclePhases.length; i++) {
		addPluginExecution(plugin, "execute", lifecyclePhases[i]);
	}
	project.getBuild().addPlugin(plugin);
}
 
开发者ID:javabuild,项目名称:builder-parent,代码行数:20,代码来源:MavenBuilderExtension.java

示例11: update

import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
private Plugin update(final org.guvnor.common.services.project.model.Plugin from,
                      final Plugin to) {

    to.setGroupId(from.getGroupId());
    to.setArtifactId(from.getArtifactId());
    to.setVersion(from.getVersion());

    // false is the default value, so we only set it if value is true
    if (from.isExtensions()) {
        to.setExtensions(from.isExtensions());
    } else {
        to.setExtensions(null);
    }

    new DependencyUpdater(to.getDependencies()).updateDependencies(from.getDependencies());

    return to;
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:19,代码来源:MavenPluginUpdater.java

示例12: prepareBuildWithSurefirePlugin

import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
static Build prepareBuildWithSurefirePlugin(String version) {
    Plugin surefirePlugin = new Plugin();
    surefirePlugin.setArtifactId(ApplicablePlugins.SUREFIRE.getArtifactId());
    surefirePlugin.setVersion(version);

    Build build = new Build();
    build.addPlugin(surefirePlugin);

    return build;
}
 
开发者ID:arquillian,项目名称:smart-testing,代码行数:11,代码来源:ModelUtil.java

示例13: getVersionFixPlugin

import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
public Plugin getVersionFixPlugin() {
    PluginExecution execution = new PluginExecution();
    execution.setId("versionfix");
    execution.addGoal("versionfix");

    Plugin result = new Plugin();
    result.setGroupId("com.iggroup.maven.cdversion");
    result.setArtifactId("versionfix-maven-plugin");
    result.setVersion("${project.version}");
    result.addExecution(execution);
    
    return result;
}
 
开发者ID:IG-Group,项目名称:cdversion-maven-extension,代码行数:14,代码来源:Plugins.java

示例14: setup

import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
@Before
public void setup() {
    item = new PluginMerger();
    project = new MavenProject();

    Plugin dummyPlugin1 = new Plugin();
    dummyPlugin1.setArtifactId("dummy-artifact");
    Plugin dummyPlugin2 = new Plugin();
    dummyPlugin2.setGroupId("dummy.group");
    dummyPlugin2.setArtifactId("dummy-artifact");
    dummyPlugins = new ArrayList();
    dummyPlugins.add(dummyPlugin1);
    dummyPlugins.add(dummyPlugin2);
}
 
开发者ID:IG-Group,项目名称:cdversion-maven-extension,代码行数:15,代码来源:PluginMergerTest.java

示例15: testMerge_emptyArtifactId

import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
@Test
public void testMerge_emptyArtifactId() {
    Plugin mergePlugin = new Plugin();
    mergePlugin.setArtifactId("");

    item.merge(project, mergePlugin);
    
    Assert.assertTrue("BuildPlugins.IsEmpty", project.getBuildPlugins().isEmpty());
}
 
开发者ID:IG-Group,项目名称:cdversion-maven-extension,代码行数:10,代码来源:PluginMergerTest.java


注:本文中的org.apache.maven.model.Plugin.setArtifactId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。