本文整理汇总了Java中org.apache.maven.model.Plugin.setVersion方法的典型用法代码示例。如果您正苦于以下问题:Java Plugin.setVersion方法的具体用法?Java Plugin.setVersion怎么用?Java Plugin.setVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.model.Plugin
的用法示例。
在下文中一共展示了Plugin.setVersion方法的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: 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;
}
示例3: 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;
}
示例4: 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);
}
示例5: 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;
}
示例6: 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;
}
示例7: 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;
}
示例8: 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);
}
示例9: 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;
}
示例10: createPluginAndInitPropertyResolver
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
private static Plugin createPluginAndInitPropertyResolver(String version, String resolverOutput) {
Mockito.when(propertyResolver.expandPropertyReferences(version)).thenReturn(resolverOutput);
Plugin p = new Plugin();
p.setVersion(version);
return p;
}
示例11: 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;
}
示例12: 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;
}
示例13: getMavenBundleMojo
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
private MojoDescriptor getMavenBundleMojo() throws Exception {
Plugin plugin = new Plugin();
plugin.setGroupId("org.apache.felix");
plugin.setArtifactId("maven-bundle-plugin");
plugin.setVersion("3.0.0");
plugin.setInherited(true);
plugin.setExtensions(true);
PluginDescriptor desc = pluginManager.loadPlugin(plugin, mavenProject.getRemotePluginRepositories(), mavenSession.getRepositorySession());
return desc.getMojo("bundle");
}
示例14: updatePluginVersion
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
protected void updatePluginVersion(Model model) {
for (Plugin plugin : model.getBuild().getPluginManagement().getPlugins()) {
if (plugin.getKey().equals(pluginDescriptor.getPluginLookupKey())) {
plugin.setVersion(pluginDescriptor.getVersion());
}
}
}
示例15: newPlugin
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
static Plugin newPlugin( String groupId, String artifactId, String version )
{
Plugin plugin = new Plugin();
plugin.setArtifactId( artifactId );
plugin.setGroupId( groupId );
plugin.setVersion( version );
return plugin;
}