Example usage for org.apache.maven.plugin MojoExecution getSource

List of usage examples for org.apache.maven.plugin MojoExecution getSource

Introduction

In this page you can find the example usage for org.apache.maven.plugin MojoExecution getSource.

Prototype

public Source getSource() 

Source Link

Document

Gets the source of this execution.

Usage

From source file:com.github.sdedwards.m2e_nar.internal.NarTestCompileBuildParticipant.java

License:Apache License

public NarTestCompileBuildParticipant(MojoExecution execution, boolean runOnIncremental,
        boolean runOnConfiguration) {
    super(new MojoExecution(execution.getMojoDescriptor(), execution.getExecutionId(), execution.getSource()),
            runOnIncremental, runOnConfiguration);
    // Some versions of nar-maven-plugin don't have a nar-test-unpack goal
    // this means the test artifacts won't be available to us.
    // What we need to do is run the nar-testCompile goal without any tests
    // its configuration in order to just unpack.
    Xpp3Dom configuration = new Xpp3Dom(execution.getConfiguration());
    logger.debug("Configuration before: " + configuration);
    for (int i = 0; i < configuration.getChildCount(); ++i) {
        if ("tests".equals(configuration.getChild(i).getName())) {
            configuration.removeChild(i);
            break;
        }//from ww  w .  j  av  a2s .c  o  m
    }
    logger.debug("Configuration after: " + configuration);
    getMojoExecution().setConfiguration(configuration);
}