本文整理汇总了Java中org.apache.maven.model.PluginContainer类的典型用法代码示例。如果您正苦于以下问题:Java PluginContainer类的具体用法?Java PluginContainer怎么用?Java PluginContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PluginContainer类属于org.apache.maven.model包,在下文中一共展示了PluginContainer类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updatePluginContainer
import org.apache.maven.model.PluginContainer; //导入依赖的package包/类
/**
* Method updatePluginContainer
*
* @param value
* @param element
* @param counter
* @param xmlTag
*/
protected void updatePluginContainer( PluginContainer value, String xmlTag, Counter counter, Element element )
{
boolean shouldExist = value != null;
Element root = updateElement( counter, element, xmlTag, shouldExist );
if ( shouldExist )
{
Counter innerCount = new Counter( counter.getDepth() + 1 );
iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" );
}
}
示例2: testShouldNotMergePluginExecutionWhenExecInheritedIsFalseAndTreatAsInheritanceIsTrue
import org.apache.maven.model.PluginContainer; //导入依赖的package包/类
public void testShouldNotMergePluginExecutionWhenExecInheritedIsFalseAndTreatAsInheritanceIsTrue()
{
String gid = "group";
String aid = "artifact";
String ver = "1";
PluginContainer parent = new PluginContainer();
Plugin pParent = createPlugin( gid, aid, ver, Collections.EMPTY_MAP );
pParent.setInherited( Boolean.toString( true ) );
PluginExecution eParent = new PluginExecution();
String testId = "test";
eParent.setId( testId );
eParent.addGoal( "run" );
eParent.setPhase( "initialize" );
eParent.setInherited( Boolean.toString( false ) );
pParent.addExecution( eParent );
parent.addPlugin( pParent );
PluginContainer child = new PluginContainer();
Plugin pChild = createPlugin( gid, aid, ver, Collections.EMPTY_MAP );
PluginExecution eChild = new PluginExecution();
eChild.setId( "child-specified" );
eChild.addGoal( "child" );
eChild.setPhase( "compile" );
pChild.addExecution( eChild );
child.addPlugin( pChild );
ModelUtils.mergePluginDefinitions( pChild, pParent, true );
Map executionMap = pChild.getExecutionsAsMap();
assertNull( "test execution should not be inherited from parent.", executionMap.get( testId ) );
}
示例3: testShouldNotMergePluginExecutionWhenPluginInheritedIsFalseAndTreatAsInheritanceIsTrue
import org.apache.maven.model.PluginContainer; //导入依赖的package包/类
public void testShouldNotMergePluginExecutionWhenPluginInheritedIsFalseAndTreatAsInheritanceIsTrue()
{
String gid = "group";
String aid = "artifact";
String ver = "1";
PluginContainer parent = new PluginContainer();
Plugin pParent = createPlugin( gid, aid, ver, Collections.EMPTY_MAP );
pParent.setInherited( Boolean.toString( false ) );
PluginExecution eParent = new PluginExecution();
String testId = "test";
eParent.setId( testId );
eParent.addGoal( "run" );
eParent.setPhase( "initialize" );
eParent.setInherited( Boolean.toString( true ) );
pParent.addExecution( eParent );
parent.addPlugin( pParent );
PluginContainer child = new PluginContainer();
Plugin pChild = createPlugin( gid, aid, ver, Collections.EMPTY_MAP );
PluginExecution eChild = new PluginExecution();
eChild.setId( "child-specified" );
eChild.addGoal( "child" );
eChild.setPhase( "compile" );
pChild.addExecution( eChild );
child.addPlugin( pChild );
ModelUtils.mergePluginDefinitions( pChild, pParent, true );
Map executionMap = pChild.getExecutionsAsMap();
assertNull( "test execution should not be inherited from parent.", executionMap.get( testId ) );
}
示例4: testShouldMergePluginExecutionWhenExecInheritedIsTrueAndTreatAsInheritanceIsTrue
import org.apache.maven.model.PluginContainer; //导入依赖的package包/类
public void testShouldMergePluginExecutionWhenExecInheritedIsTrueAndTreatAsInheritanceIsTrue()
{
String gid = "group";
String aid = "artifact";
String ver = "1";
PluginContainer parent = new PluginContainer();
Plugin pParent = createPlugin( gid, aid, ver, Collections.EMPTY_MAP );
pParent.setInherited( Boolean.toString( true ) );
PluginExecution eParent = new PluginExecution();
String testId = "test";
eParent.setId( testId );
eParent.addGoal( "run" );
eParent.setPhase( "initialize" );
eParent.setInherited( Boolean.toString( true ) );
pParent.addExecution( eParent );
parent.addPlugin( pParent );
PluginContainer child = new PluginContainer();
Plugin pChild = createPlugin( gid, aid, ver, Collections.EMPTY_MAP );
PluginExecution eChild = new PluginExecution();
eChild.setId( "child-specified" );
eChild.addGoal( "child" );
eChild.setPhase( "compile" );
pChild.addExecution( eChild );
child.addPlugin( pChild );
ModelUtils.mergePluginDefinitions( pChild, pParent, true );
Map executionMap = pChild.getExecutionsAsMap();
assertNotNull( "test execution should be inherited from parent.", executionMap.get( testId ) );
}
示例5: testShouldNotInheritPluginWithInheritanceSetToFalse
import org.apache.maven.model.PluginContainer; //导入依赖的package包/类
public void testShouldNotInheritPluginWithInheritanceSetToFalse()
{
PluginContainer parent = new PluginContainer();
Plugin parentPlugin = createPlugin( "group", "artifact", "1.0", Collections.EMPTY_MAP );
parentPlugin.setInherited( "false" );
parent.addPlugin( parentPlugin );
PluginContainer child = new PluginContainer();
child.addPlugin( createPlugin( "group3", "artifact3", "1.0", Collections.EMPTY_MAP ) );
ModelUtils.mergePluginLists( child, parent, true );
List results = child.getPlugins();
assertEquals( 1, results.size() );
Plugin result1 = (Plugin) results.get( 0 );
assertEquals( "group3", result1.getGroupId() );
assertEquals( "artifact3", result1.getArtifactId() );
}
示例6: testShouldKeepOriginalPluginOrdering
import org.apache.maven.model.PluginContainer; //导入依赖的package包/类
/**
* Verifies MNG-1499: The order of the merged list should be the plugins specified by the parent followed by the
* child list.
*/
public void testShouldKeepOriginalPluginOrdering()
{
Plugin parentPlugin1 = new Plugin();
parentPlugin1.setArtifactId( "testArtifact" );
parentPlugin1.setGroupId( "zzz" ); // This will put this plugin last in the sorted map
parentPlugin1.setVersion( "1.0" );
PluginExecution parentExecution1 = new PluginExecution();
parentExecution1.setId( "testExecution" );
parentPlugin1.addExecution( parentExecution1 );
Plugin parentPlugin2 = new Plugin();
parentPlugin2.setArtifactId( "testArtifact" );
parentPlugin2.setGroupId( "yyy" );
parentPlugin2.setVersion( "1.0" );
PluginExecution parentExecution2 = new PluginExecution();
parentExecution2.setId( "testExecution" );
parentPlugin2.addExecution( parentExecution2 );
PluginContainer parentContainer = new PluginContainer();
parentContainer.addPlugin(parentPlugin1);
parentContainer.addPlugin(parentPlugin2);
Plugin childPlugin1 = new Plugin();
childPlugin1.setArtifactId( "testArtifact" );
childPlugin1.setGroupId( "bbb" );
childPlugin1.setVersion( "1.0" );
PluginExecution childExecution1 = new PluginExecution();
childExecution1.setId( "testExecution" );
childPlugin1.addExecution( childExecution1 );
Plugin childPlugin2 = new Plugin();
childPlugin2.setArtifactId( "testArtifact" );
childPlugin2.setGroupId( "aaa" );
childPlugin2.setVersion( "1.0" );
PluginExecution childExecution2 = new PluginExecution();
childExecution2.setId( "testExecution" );
childPlugin2.addExecution( childExecution2 );
PluginContainer childContainer = new PluginContainer();
childContainer.addPlugin(childPlugin1);
childContainer.addPlugin(childPlugin2);
ModelUtils.mergePluginLists(childContainer, parentContainer, true);
assertEquals( 4, childContainer.getPlugins().size() );
assertSame(parentPlugin1, childContainer.getPlugins().get(0));
assertSame(parentPlugin2, childContainer.getPlugins().get(1));
assertSame(childPlugin1, childContainer.getPlugins().get(2));
assertSame(childPlugin2, childContainer.getPlugins().get(3));
}
示例7: mergePluginContainer
import org.apache.maven.model.PluginContainer; //导入依赖的package包/类
protected void mergePluginContainer( PluginContainer target, PluginContainer source, boolean sourceDominant,
Map<Object, Object> context )
{
mergePluginContainer_Plugins( target, source, sourceDominant, context );
}
示例8: testShouldPreserveChildOrderingOfPluginsAfterParentMerge
import org.apache.maven.model.PluginContainer; //导入依赖的package包/类
/**
* Test that this is the resulting ordering of plugins after merging:
*
* Given:
*
* parent: X -> A -> B -> D -> E
* child: Y -> A -> C -> D -> F
*
* Result:
*
* X -> Y -> A -> B -> C -> D -> E -> F
*/
public void testShouldPreserveChildOrderingOfPluginsAfterParentMerge()
{
PluginContainer parent = new PluginContainer();
parent.addPlugin( createPlugin( "group", "artifact", "1.0", Collections.EMPTY_MAP ) );
parent.addPlugin( createPlugin( "group2", "artifact2", "1.0", Collections.singletonMap( "key", "value" ) ) );
PluginContainer child = new PluginContainer();
child.addPlugin( createPlugin( "group3", "artifact3", "1.0", Collections.EMPTY_MAP ) );
child.addPlugin( createPlugin( "group2", "artifact2", "1.0", Collections.singletonMap( "key2", "value2" ) ) );
ModelUtils.mergePluginLists( child, parent, true );
List results = child.getPlugins();
assertEquals( 3, results.size() );
Plugin result1 = (Plugin) results.get( 0 );
assertEquals( "group", result1.getGroupId() );
assertEquals( "artifact", result1.getArtifactId() );
Plugin result2 = (Plugin) results.get( 1 );
assertEquals( "group3", result2.getGroupId() );
assertEquals( "artifact3", result2.getArtifactId() );
Plugin result3 = (Plugin) results.get( 2 );
assertEquals( "group2", result3.getGroupId() );
assertEquals( "artifact2", result3.getArtifactId() );
Xpp3Dom result3Config = (Xpp3Dom) result3.getConfiguration();
assertNotNull( result3Config );
assertEquals( "value", result3Config.getChild( "key" ).getValue() );
assertEquals( "value2", result3Config.getChild( "key2" ).getValue() );
}