Java Code Examples for org.apache.maven.model.Plugin#setConfiguration()

The following examples show how to use org.apache.maven.model.Plugin#setConfiguration() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MavenConfigurationExtractorTest.java    From jkube with Eclipse Public License 2.0 6 votes vote down vote up
private Plugin createFakePlugin(String config) {
    Plugin plugin = new Plugin();
    plugin.setArtifactId("jkube-maven-plugin");
    plugin.setGroupId("org.eclipse.jkube");
    String content = "<configuration>"
        + config
        + "</configuration>";
    Xpp3Dom dom;
    try {
        dom = Xpp3DomBuilder.build(new StringReader(content));
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    plugin.setConfiguration(dom);

    return plugin;
}
 
Example 2
Source File: RequirePropertyDivergesTest.java    From extra-enforcer-rules with Apache License 2.0 6 votes vote down vote up
/**
 * 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 );
}
 
Example 3
Source File: CreateMavenBundlePom.java    From tesb-studio-se with Apache License 2.0 6 votes vote down vote up
/**
 * Skip clean control-bundle file in target folde, in case of using mvn clean + package goal
 *
 * @return plugin
 */
private Plugin addSkipMavenCleanPlugin() {
    Plugin plugin = new Plugin();

    plugin.setGroupId("org.apache.maven.plugins");
    plugin.setArtifactId("maven-clean-plugin");
    plugin.setVersion("3.0.0");

    Xpp3Dom configuration = new Xpp3Dom("configuration");
    Xpp3Dom skipClean = new Xpp3Dom("skip");
    skipClean.setValue("true");
    configuration.addChild(skipClean);
    plugin.setConfiguration(configuration);

    return plugin;
}
 
Example 4
Source File: CreateMavenDataServicePom.java    From tesb-studio-se with Apache License 2.0 6 votes vote down vote up
private Plugin addControlBundleMavenPlugin() {

        Plugin plugin = new Plugin();

        plugin.setGroupId("org.apache.maven.plugins");
        plugin.setArtifactId("maven-jar-plugin");
        plugin.setVersion("3.0.2");

        plugin.setExtensions(true);

        Xpp3Dom configuration = new Xpp3Dom("configuration");
        Xpp3Dom archive = new Xpp3Dom("archive");
        Xpp3Dom manifest = new Xpp3Dom("manifestFile");
        manifest.setValue("${project.build.outputDirectory}/META-INF/MANIFEST.MF");
        archive.addChild(manifest);
        configuration.addChild(archive);
        plugin.setConfiguration(configuration);

        return plugin;
    }
 
Example 5
Source File: CreateMavenDataServicePom.java    From tesb-studio-se with Apache License 2.0 6 votes vote down vote up
/**
 * Avoid clean control-bundle file in target folde, in case of using mvn clean package, TESB-22296
 *
 * @return plugin
 */
private Plugin addSkipMavenCleanPlugin() {
    Plugin plugin = new Plugin();

    plugin.setGroupId("org.apache.maven.plugins");
    plugin.setArtifactId("maven-clean-plugin");
    plugin.setVersion("3.0.0");

    Xpp3Dom configuration = new Xpp3Dom("configuration");
    Xpp3Dom skipClean = new Xpp3Dom("skip");
    skipClean.setValue("true");
    configuration.addChild(skipClean);
    plugin.setConfiguration(configuration);

    return plugin;
}
 
Example 6
Source File: DistributionEnforcingManipulatorTest.java    From pom-manipulation-ext with Apache License 2.0 6 votes vote down vote up
@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 );
}
 
Example 7
Source File: DistributionEnforcingManipulatorTest.java    From pom-manipulation-ext with Apache License 2.0 6 votes vote down vote up
@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 );
}
 
Example 8
Source File: RequirePropertyDivergesTest.java    From extra-enforcer-rules with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 9
Source File: MavenUtils.java    From developer-studio with Apache License 2.0 5 votes vote down vote up
public static void addMavenCompilerPlugin(MavenProject mavenProject){
	Plugin plugin;
	plugin = MavenUtils.createPluginEntry(mavenProject, "org.apache.maven.plugins", "maven-compiler-plugin", "3.1" , false);
	Xpp3Dom configurationNode = createMainConfigurationNode();
	Xpp3Dom sourceNode = createXpp3Node(configurationNode, "source");
	sourceNode.setValue("1.5");
	Xpp3Dom targetNode = createXpp3Node(configurationNode, "target");
	targetNode.setValue("1.5");
	plugin.setConfiguration(configurationNode);		
}
 
Example 10
Source File: CreateMavenBundlePom.java    From tesb-studio-se with Apache License 2.0 4 votes vote down vote up
private Plugin addSkipDeployFeatureMavenPlugin() {

        Plugin plugin = new Plugin();

        plugin.setGroupId("org.apache.maven.plugins");
        plugin.setArtifactId("maven-deploy-plugin");
        plugin.setVersion("2.7");

        Xpp3Dom configuration = new Xpp3Dom("configuration");

        Xpp3Dom skip = new Xpp3Dom("skip");
        skip.setValue("true");
        configuration.addChild(skip);
        plugin.setConfiguration(configuration);

        return plugin;

    }
 
Example 11
Source File: CreateMavenDataServicePom.java    From tesb-studio-se with Apache License 2.0 4 votes vote down vote up
private Plugin addSkipDeployFeatureMavenPlugin() {

        Plugin plugin = new Plugin();

        plugin.setGroupId("org.apache.maven.plugins");
        plugin.setArtifactId("maven-deploy-plugin");
        plugin.setVersion("2.7");

        Xpp3Dom configuration = new Xpp3Dom("configuration");

        Xpp3Dom skip = new Xpp3Dom("skip");
        skip.setValue("true");
        configuration.addChild(skip);
        plugin.setConfiguration(configuration);

        return plugin;

    }
 
Example 12
Source File: MavenUtils.java    From developer-studio with Apache License 2.0 4 votes vote down vote up
public static Xpp3Dom createMainConfigurationNode(Plugin plugin) {
	String tagName = "configuration";
	Xpp3Dom configuration = createXpp3Node(tagName);
	plugin.setConfiguration(configuration);
	return configuration;
}