本文整理汇总了Java中org.apache.maven.model.Plugin.setGroupId方法的典型用法代码示例。如果您正苦于以下问题:Java Plugin.setGroupId方法的具体用法?Java Plugin.setGroupId怎么用?Java Plugin.setGroupId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.model.Plugin
的用法示例。
在下文中一共展示了Plugin.setGroupId方法的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;
}
示例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");
}
示例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());
}
示例4: 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;
}
示例5: 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;
}
示例6: 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;
}
示例7: 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 );
}
示例8: 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);
}
示例9: 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;
}
示例10: 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;
}
示例11: 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);
}
示例12: getBuildWithDockerPluginDefinition
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
private static void getBuildWithDockerPluginDefinition(Model model) {
Build build = new Build();
model.setBuild(build);
Plugin plugin = new Plugin();
plugin.setGroupId("io.fabric8");
plugin.setArtifactId("docker-maven-plugin");
plugin.setVersion("0.14.2");
build.addPlugin(plugin);
}
示例13: getSurefirePlugin
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
private static Plugin getSurefirePlugin() {
final Plugin surefirePlugin = new Plugin();
surefirePlugin.setGroupId("org.apache.maven.plugins");
surefirePlugin.setArtifactId("maven-surefire-plugin");
surefirePlugin.setVersion("2.19.1");
final Xpp3Dom mavenPluginConfiguration = new Xpp3Dom("configuration");
final Xpp3Dom skipTests = new Xpp3Dom("skipTests");
skipTests.setValue("${skipTests}");
mavenPluginConfiguration.addChild(skipTests);
surefirePlugin.setConfiguration(mavenPluginConfiguration);
return surefirePlugin;
}
示例14: createPlugin
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
private static Plugin createPlugin(String gid, String aid, String version) {
Plugin p = new Plugin();
p.setGroupId(gid);
p.setArtifactId(aid);
p.setVersion(version);
return p;
}
示例15: loadPlugin
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
Plugin loadPlugin(Xpp3Dom pluginDef) {
String groupId = pluginDef.getChild("groupId").getValue();
String artifactId = pluginDef.getChild("artifactId").getValue();
String version = pluginDef.getChild("version").getValue();
Plugin plugin = new Plugin();
plugin.setGroupId(groupId);
plugin.setArtifactId(artifactId);
plugin.setVersion(version);
return plugin;
}