本文整理汇总了Java中org.apache.maven.model.PluginExecution.setConfiguration方法的典型用法代码示例。如果您正苦于以下问题:Java PluginExecution.setConfiguration方法的具体用法?Java PluginExecution.setConfiguration怎么用?Java PluginExecution.setConfiguration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.model.PluginExecution
的用法示例。
在下文中一共展示了PluginExecution.setConfiguration方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPlugin
import org.apache.maven.model.PluginExecution; //导入方法依赖的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.PluginExecution; //导入方法依赖的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: testExecuteInParentWithConfigurationInExecution
import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
/**
* Test of execute method, of class RequirePropertyDiverges.
*/
@Test
public void testExecuteInParentWithConfigurationInExecution() throws EnforcerRuleException
{
RequirePropertyDiverges mockInstance = createMockRule();
final MavenProject project = createMavenProject( "company", "company-parent-pom" );
final Build build = new Build();
build.setPluginManagement( new PluginManagement() );
final Plugin plugin = newPlugin( "org.apache.maven.plugins", "maven-enforcer-plugin", "1.0" );
final Xpp3Dom configuration = createPluginConfiguration();
PluginExecution pluginExecution = new PluginExecution();
pluginExecution.setConfiguration( configuration );
plugin.addExecution( pluginExecution );
build.addPlugin( plugin );
project.getOriginalModel().setBuild( build );
setUpHelper(project, "parentValue");
mockInstance.execute( helper );
}
示例4: expand
import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
private void expand( List<Plugin> plugins )
{
for ( Plugin plugin : plugins )
{
Xpp3Dom pluginConfiguration = (Xpp3Dom) plugin.getConfiguration();
if ( pluginConfiguration != null )
{
for ( PluginExecution execution : plugin.getExecutions() )
{
Xpp3Dom executionConfiguration = (Xpp3Dom) execution.getConfiguration();
executionConfiguration =
Xpp3Dom.mergeXpp3Dom( executionConfiguration, new Xpp3Dom( pluginConfiguration ) );
execution.setConfiguration( executionConfiguration );
}
}
}
}
示例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: updateSourceFolder
import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
private static void updateSourceFolder(IProject project, MavenProject mavenProject, File mavenProjectSaveLocation) throws JavaModelException{
Plugin sourcePluginEntry = createPluginEntry(mavenProject, "org.codehaus.mojo", "build-helper-maven-plugin", "1.8", false);
PluginExecution pluginExecution=new PluginExecution();
IPackageFragmentRoot[] sourceFoldersForProject =
JavaUtils.getSourceFoldersForProject(project);
if (sourceFoldersForProject.length > 0) {
String sourceFolder =
FileUtils.getRelativePath(mavenProjectSaveLocation.getParentFile(),
sourceFoldersForProject[0].getResource()
.getLocation()
.toFile()).replaceAll(Pattern.quote(File.separator), "/");
mavenProject.getModel().getBuild().setSourceDirectory(sourceFolder);
Xpp3Dom configurationNode = createMainConfigurationNode();
pluginExecution.setConfiguration(configurationNode);
Xpp3Dom sourcesNode = createXpp3Node(configurationNode, "sources");
for (int i = 1; i < sourceFoldersForProject.length; i++) {
IPackageFragmentRoot packageFragmentRoot = sourceFoldersForProject[i];
File sourceDirectory = packageFragmentRoot.getResource().getLocation().toFile();
String relativePath =
FileUtils.getRelativePath(mavenProjectSaveLocation.getParentFile(),
sourceDirectory).replaceAll(Pattern.quote(File.separator), "/");
Xpp3Dom sourceNode = createXpp3Node(sourcesNode, "source");
sourceNode.setValue(relativePath);
}
sourcePluginEntry.addExecution(pluginExecution);
}
}
示例7: 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 );
}