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


Java Build.addPlugin方法代码示例

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


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

示例1: testExecuteInParentWithConfigurationInPluginManagement

import org.apache.maven.model.Build; //导入方法依赖的package包/类
/**
 * Test of execute method, of class RequirePropertyDiverges.
 */
@Test
public void testExecuteInParentWithConfigurationInPluginManagement() throws EnforcerRuleException
{
    RequirePropertyDiverges mockInstance = createMockRule();
    final MavenProject project = createMavenProject( "company", "company-parent-pom" );
    final Build build = new Build();
    // create pluginManagement
    final Plugin pluginInManagement = newPlugin( "org.apache.maven.plugins", "maven-enforcer-plugin", "1.0");
    final Xpp3Dom configuration = createPluginConfiguration();
    pluginInManagement.setConfiguration( configuration );
    final PluginManagement pluginManagement = new PluginManagement();
    pluginManagement.addPlugin( pluginInManagement );
    build.setPluginManagement( pluginManagement );
    // create plugins
    final Plugin pluginInPlugins = newPlugin( "org.apache.maven.plugins", "maven-enforcer-plugin", "1.0");
    build.addPlugin( pluginInPlugins );
    // add build
    project.getOriginalModel().setBuild( build );
    //project.getOriginalModel().setBuild( build );
    setUpHelper( project, "parentValue" );
    mockInstance.execute( helper );
}
 
开发者ID:mojohaus,项目名称:extra-enforcer-rules,代码行数:26,代码来源:RequirePropertyDivergesTest.java

示例2: testExecuteInParentWithConfigurationInExecution

import org.apache.maven.model.Build; //导入方法依赖的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 );
}
 
开发者ID:mojohaus,项目名称:extra-enforcer-rules,代码行数:21,代码来源:RequirePropertyDivergesTest.java

示例3: projectUnchangedWhenModeIsNone

import org.apache.maven.model.Build; //导入方法依赖的package包/类
@Test
public void projectUnchangedWhenModeIsNone()
    throws Exception
{
    final Plugin plugin = new Plugin();
    plugin.setGroupId( MAVEN_PLUGIN_GROUPID );
    plugin.setArtifactId( MAVEN_DEPLOY_ARTIFACTID );
    plugin.setConfiguration( simpleSkipConfig( true ) );

    final Build build = new Build();
    build.addPlugin( plugin );

    final Model model = new Model();
    model.setModelVersion( "4.0.0" );
    model.setGroupId( "org.foo" );
    model.setArtifactId( "bar" );
    model.setVersion( "1" );

    model.setBuild( build );

    applyTest( none, model, null );
}
 
开发者ID:release-engineering,项目名称:pom-manipulation-ext,代码行数:23,代码来源:DistributionEnforcingManipulatorTest.java

示例4: projectDeploySkipTurnedOffWhenModeIsOff

import org.apache.maven.model.Build; //导入方法依赖的package包/类
@Test
public void projectDeploySkipTurnedOffWhenModeIsOff()
    throws Exception
{
    final Plugin plugin = new Plugin();
    plugin.setGroupId( MAVEN_PLUGIN_GROUPID );
    plugin.setArtifactId( MAVEN_DEPLOY_ARTIFACTID );
    plugin.setConfiguration( simpleSkipConfig( true ) );

    final Build build = new Build();
    build.addPlugin( plugin );

    final Model model = new Model();
    model.setModelVersion( "4.0.0" );
    model.setGroupId( "org.foo" );
    model.setArtifactId( "bar" );
    model.setVersion( "1" );

    model.setBuild( build );

    applyTest( off, model, model );
    assertSkip( model, null, true, Boolean.FALSE );
}
 
开发者ID:release-engineering,项目名称:pom-manipulation-ext,代码行数:24,代码来源:DistributionEnforcingManipulatorTest.java

示例5: shouldIgnoreMissingPlugin

import org.apache.maven.model.Build; //导入方法依赖的package包/类
@Test
public void shouldIgnoreMissingPlugin() {
    Plugin barPlugin = new Plugin();
    barPlugin.setArtifactId("bar-plugin");
    barPlugin.setGroupId("com.acme");
    barPlugin.setVersion("1.0");

    Build fooBuild = new Build();
    fooBuild.addPlugin(barPlugin);

    Model foo = pom().artifactId("foo").model();
    foo.setBuild(fooBuild);

    createArtifact(repoFooDir, foo);

    validationExecutor.execute(ctx);

    assertSuccess();
}
 
开发者ID:release-engineering,项目名称:redhat-repository-validator,代码行数:20,代码来源:TestDependenciesValidator.java

示例6: shouldIgnoreMissingPluginDependency

import org.apache.maven.model.Build; //导入方法依赖的package包/类
@Test
public void shouldIgnoreMissingPluginDependency() {
    Dependency barApi = dependency().artifactId("bar-api").groupId("com.acme").version("1.0").build();

    Plugin barPlugin = new Plugin();
    barPlugin.setArtifactId("bar-plugin");
    barPlugin.setGroupId("com.acme");
    barPlugin.setVersion("1.0");
    barPlugin.addDependency(barApi);

    Build fooBuild = new Build();
    fooBuild.addPlugin(barPlugin);

    Model foo = pom().artifactId("foo").model();
    foo.setBuild(fooBuild);

    createArtifact(repoFooDir, foo);

    validationExecutor.execute(ctx);

    assertSuccess();
}
 
开发者ID:release-engineering,项目名称:redhat-repository-validator,代码行数:23,代码来源:TestDependenciesValidator.java

示例7: prepareBuildWithSurefirePlugin

import org.apache.maven.model.Build; //导入方法依赖的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

示例8: getBuildWithDockerPluginDefinition

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

示例9: createParentProject

import org.apache.maven.model.Build; //导入方法依赖的package包/类
private MavenProject createParentProject() {
    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();
    plugin.setConfiguration( configuration );
    build.addPlugin( plugin );
    project.getOriginalModel().setBuild( build );
    return project;
}
 
开发者ID:mojohaus,项目名称:extra-enforcer-rules,代码行数:12,代码来源:RequirePropertyDivergesTest.java

示例10: testShouldMergeOnePluginWithInheritExecutionWithoutDuplicatingPluginInList

import org.apache.maven.model.Build; //导入方法依赖的package包/类
public void testShouldMergeOnePluginWithInheritExecutionWithoutDuplicatingPluginInList()
{
    Plugin parent = new Plugin();
    parent.setArtifactId( "testArtifact" );
    parent.setGroupId( "testGroup" );
    parent.setVersion( "1.0" );

    PluginExecution parentExecution = new PluginExecution();
    parentExecution.setId( "testExecution" );

    parent.addExecution( parentExecution );

    Build parentContainer = new Build();
    parentContainer.addPlugin( parent );

    Plugin child = new Plugin();
    child.setArtifactId( "testArtifact" );
    child.setGroupId( "testGroup" );
    child.setVersion( "1.0" );

    Build childContainer = new Build();
    childContainer.addPlugin( child );

    ModelUtils.mergePluginLists( childContainer, parentContainer, true );

    List plugins = childContainer.getPlugins();

    assertEquals( 1, plugins.size() );

    Plugin plugin = (Plugin) plugins.get( 0 );

    assertEquals( 1, plugin.getExecutions().size() );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:34,代码来源:ModelUtilsTest.java

示例11: testPluginDependenciesInfluenceSorting_DeclarationInParent

import org.apache.maven.model.Build; //导入方法依赖的package包/类
public void testPluginDependenciesInfluenceSorting_DeclarationInParent()
    throws Exception
{
    List<MavenProject> projects = new ArrayList<MavenProject>();

    MavenProject parentProject = createProject( "groupId", "parent-declarer", "1.0" );
    projects.add( parentProject );

    MavenProject pluginProject = createProject( "groupId", "plugin", "1.0" );
    pluginProject.setParent( parentProject );
    pluginProject.getModel().setParent( createParent( parentProject ) );
    projects.add( pluginProject );

    MavenProject pluginLevelDepProject = createProject( "groupId", "plugin-level-dep", "1.0" );
    pluginLevelDepProject.setParent( parentProject );
    pluginLevelDepProject.getModel().setParent( createParent( parentProject ) );
    projects.add( pluginLevelDepProject );

    Plugin plugin = createPlugin( pluginProject );

    plugin.addDependency( createDependency( pluginLevelDepProject ) );

    Build build = parentProject.getModel().getBuild();

    build.addPlugin( plugin );

    projects = new ProjectSorter( projects ).getSortedProjects();

    System.out.println( projects );

    assertEquals( parentProject, projects.get( 0 ) );

    // the order of these two is non-deterministic, based on when they're added to the reactor.
    assertTrue( projects.contains( pluginProject ) );
    assertTrue( projects.contains( pluginLevelDepProject ) );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:37,代码来源:ProjectSorterTest.java

示例12: FitNesseMojoTestHelper

import org.apache.maven.model.Build; //导入方法依赖的package包/类
FitNesseMojoTestHelper() {
   this.artifactHandler = mock( ArtifactHandler.class );
   this.artifactResolver = mock( ArtifactResolver.class );
   this.realm = mock( ClassRealm.class );

   this.pluginArtifact = new DefaultArtifact( getClass().getPackage().getName(), getClass().getSimpleName(), "version", "scope", "type", "classifier", this.artifactHandler );

   this.fitnesseArtifact = new DefaultArtifact( "org.fitnesse", "fitnesse", "20151230", "compile", "jar", null, this.artifactHandler );
   this.fitnesseArtifact.setFile( new File( getClass().getResource( "/dummy.jar" ).getPath() ) );

   when( this.artifactResolver.resolve( argThat( new ResolutionRequestForArtifact( this.fitnesseArtifact ) ) ) ).thenReturn( createArtifactResolutionResult( this.fitnesseArtifact ) );

   this.plugin = new Plugin();
   this.plugin.setGroupId( this.pluginArtifact.getGroupId() );
   this.plugin.setArtifactId( this.pluginArtifact.getArtifactId() );

   Build build = new Build();
   build.addPlugin( this.plugin );

   this.mojo = new TestFitNesseMojo();
   this.mojo.project = new MavenProject();
   this.mojo.resolver = this.artifactResolver;
   this.mojo.fitNesseHelper = mock( FitNesseHelper.class );
   this.mojo.useProjectDependencies = new HashSet<String>();

   this.mojo.pluginDescriptor = new PluginDescriptor();
   this.mojo.pluginDescriptor.setGroupId( this.pluginArtifact.getGroupId() );
   this.mojo.pluginDescriptor.setArtifactId( this.pluginArtifact.getArtifactId() );
   this.mojo.pluginDescriptor.setArtifacts( Collections.singletonList( this.fitnesseArtifact ) );
   this.mojo.pluginDescriptor.setClassRealm( this.realm );
   this.mojo.project.setPluginArtifacts( Collections.singleton( this.pluginArtifact ) );
   this.mojo.project.setBuild( build );
   this.mojo.project.setFile( new File( getClass().getResource( "pom.xml" ).getPath() ) );
   this.mojo.project.setArtifactId( "ARTIFACT_ID" );
   this.mojo.project.setVersion( "VERSION" );
   this.mojo.project.getBuild().setTestOutputDirectory( "target/test-classes" );
   this.mojo.project.getBuild().setOutputDirectory( "target/classes" );
   this.mojo.project.setDependencyArtifacts( new HashSet<Artifact>() );

   this.systemProperties = new Properties();
   this.mojo.session = mock( MavenSession.class );
   when( this.mojo.session.getSystemProperties() ).thenReturn( this.systemProperties );

   addDependency( "cg1", "ca1", Artifact.SCOPE_COMPILE );
   addDependency( "cg1", "ca2", Artifact.SCOPE_COMPILE );
   addDependency( "cg2", "ca3", Artifact.SCOPE_COMPILE );

   addDependency( "tg1", "ta1", Artifact.SCOPE_TEST );
   addDependency( "tg1", "ta2", Artifact.SCOPE_TEST );
   addDependency( "tg2", "ta3", Artifact.SCOPE_TEST );

   addDependency( "rg1", "ra1", Artifact.SCOPE_RUNTIME );
   addDependency( "rg1", "ra2", Artifact.SCOPE_RUNTIME );
   addDependency( "rg2", "ra3", Artifact.SCOPE_RUNTIME );

   addDependency( "pg1", "pa1", Artifact.SCOPE_PROVIDED );
   addDependency( "pg1", "pa2", Artifact.SCOPE_PROVIDED );
   addDependency( "pg2", "pa3", Artifact.SCOPE_PROVIDED );

   addDependency( "sg1", "sa1", Artifact.SCOPE_SYSTEM );
   addDependency( "sg1", "sa2", Artifact.SCOPE_SYSTEM );
   addDependency( "sg2", "sa3", Artifact.SCOPE_SYSTEM );

   addDependency( "og1", "oa1", Artifact.SCOPE_COMPILE, true );
   addDependency( "og1", "oa2", Artifact.SCOPE_COMPILE, true );
   addDependency( "og2", "oa3", Artifact.SCOPE_COMPILE, true );

   this.logStream = new ByteArrayOutputStream();
   this.mojo.setLog( new DefaultLog( new PrintStreamLogger( Logger.LEVEL_INFO, "test", new PrintStream( this.logStream ) ) ) );
}
 
开发者ID:ZsZs,项目名称:FitNesseLauncher,代码行数:71,代码来源:FitNesseMojoTestHelper.java

示例13: testShouldNotFailWhenPluginDepReferencesCurrentProject

import org.apache.maven.model.Build; //导入方法依赖的package包/类
public void testShouldNotFailWhenPluginDepReferencesCurrentProject()
    throws CycleDetectedException, DuplicateProjectException
{
    MavenProject project = createProject( "group", "artifact", "1.0" );

    Build build = project.getModel().getBuild();

    Plugin plugin = createPlugin( "other.group", "other-artifact", "1.0" );

    Dependency dep = createDependency( "group", "artifact", "1.0" );

    plugin.addDependency( dep );

    build.addPlugin( plugin );

    new ProjectSorter( Collections.singletonList( project ) );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:18,代码来源:ProjectSorterTest.java

示例14: testPluginDependenciesInfluenceSorting

import org.apache.maven.model.Build; //导入方法依赖的package包/类
public void testPluginDependenciesInfluenceSorting()
    throws Exception
{
    List<MavenProject> projects = new ArrayList<MavenProject>();

    MavenProject parentProject = createProject( "groupId", "parent", "1.0" );
    projects.add( parentProject );

    MavenProject declaringProject = createProject( "groupId", "declarer", "1.0" );
    declaringProject.setParent( parentProject );
    declaringProject.getModel().setParent( createParent( parentProject ) );
    projects.add( declaringProject );

    MavenProject pluginLevelDepProject = createProject( "groupId", "plugin-level-dep", "1.0" );
    pluginLevelDepProject.setParent( parentProject );
    pluginLevelDepProject.getModel().setParent( createParent( parentProject ) );
    projects.add( pluginLevelDepProject );

    MavenProject pluginProject = createProject( "groupId", "plugin", "1.0" );
    pluginProject.setParent( parentProject );
    pluginProject.getModel().setParent( createParent( parentProject ) );
    projects.add( pluginProject );

    Plugin plugin = createPlugin( pluginProject );

    plugin.addDependency( createDependency( pluginLevelDepProject ) );

    Build build = declaringProject.getModel().getBuild();

    build.addPlugin( plugin );

    projects = new ProjectSorter( projects ).getSortedProjects();

    assertEquals( parentProject, projects.get( 0 ) );

    // the order of these two is non-deterministic, based on when they're added to the reactor.
    assertTrue( projects.contains( pluginProject ) );
    assertTrue( projects.contains( pluginLevelDepProject ) );

    // the declaring project MUST be listed after the plugin and its plugin-level dep, though.
    assertEquals( declaringProject, projects.get( 3 ) );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:43,代码来源:ProjectSorterTest.java

示例15: updatePOMModel

import org.apache.maven.model.Build; //导入方法依赖的package包/类
private Boolean updatePOMModel(Build build,
                               Boolean defaultCompilerPluginPresent,
                               Boolean alternativeCompilerPluginPresent,
                               Boolean kiePluginPresent,
                               int defaultMavenCompilerPosition,
                               int alternativeCompilerPosition,
                               int kieMavenPluginPosition) {

    Boolean overwritePOM = Boolean.FALSE;

    if (!alternativeCompilerPluginPresent) {
        //add alternative compiler and disable the default compiler
        build.addPlugin(getNewCompilerPlugin());
        alternativeCompilerPluginPresent = Boolean.TRUE;
        overwritePOM = Boolean.TRUE;
    }

    if (!defaultCompilerPluginPresent) {
        //if default maven compiler is not present we add the skip and phase none  to avoid its use
        Plugin disabledDefaultCompiler = new Plugin();
        disabledDefaultCompiler.setArtifactId(conf.get(ConfigurationKey.MAVEN_COMPILER_PLUGIN));
        disableMavenCompilerAlreadyPresent(disabledDefaultCompiler);
        build.addPlugin(disabledDefaultCompiler);
        defaultCompilerPluginPresent = Boolean.TRUE;
        overwritePOM = Boolean.TRUE;
    }

    if (defaultCompilerPluginPresent && alternativeCompilerPluginPresent) {
        if (defaultMavenCompilerPosition <= alternativeCompilerPosition) {
            //swap the positions
            Plugin defaultMavenCompiler = build.getPlugins().get(defaultMavenCompilerPosition);
            Plugin alternativeCompiler = build.getPlugins().get(alternativeCompilerPosition);
            build.getPlugins().set(defaultMavenCompilerPosition,
                                   alternativeCompiler);
            build.getPlugins().set(alternativeCompilerPosition,
                                   defaultMavenCompiler);
            overwritePOM = Boolean.TRUE;
        }
    }
    return overwritePOM;
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:42,代码来源:DefaultPomEditor.java


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