Class InstrumentMojo

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

    @Mojo(name="instrument",
          defaultPhase=PROCESS_CLASSES,
          threadSafe=true)
    public class InstrumentMojo
    extends AbstractJacocoMojo
    Performs offline instrumentation. Note that after execution of test you must restore original classes with help of "restore-instrumented-classes" goal.

    Warning: The preferred way for code coverage analysis with JaCoCo is on-the-fly instrumentation. Offline instrumentation has several drawbacks and should only be used if a specific scenario explicitly requires this mode. Please consult documentation about offline instrumentation before using this mode.

    Since:
    0.6.2
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.List<java.lang.String> excludes
      A list of class files to exclude from instrumentation.
      private java.util.List<java.lang.String> includes
      A list of class files to include in instrumentation.
      • Fields inherited from interface org.apache.maven.plugin.Mojo

        ROLE
    • Constructor Summary

      Constructors 
      Constructor Description
      InstrumentMojo()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void executeMojo()
      Executes Mojo.
      • Methods inherited from class org.apache.maven.plugin.AbstractMojo

        getLog, getPluginContext, setLog, setPluginContext
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • includes

        @Parameter
        private java.util.List<java.lang.String> includes
        A list of class files to include in instrumentation. May use wildcard characters (* and ?). When not specified everything will be included.
      • excludes

        @Parameter
        private java.util.List<java.lang.String> excludes
        A list of class files to exclude from instrumentation. May use wildcard characters (* and ?). When not specified nothing will be excluded.
    • Constructor Detail

      • InstrumentMojo

        public InstrumentMojo()
    • Method Detail

      • executeMojo

        public void executeMojo()
                         throws org.apache.maven.plugin.MojoExecutionException,
                                org.apache.maven.plugin.MojoFailureException
        Description copied from class: AbstractJacocoMojo
        Executes Mojo.
        Specified by:
        executeMojo in class AbstractJacocoMojo
        Throws:
        org.apache.maven.plugin.MojoExecutionException - if an unexpected problem occurs. Throwing this exception causes a "BUILD ERROR" message to be displayed.
        org.apache.maven.plugin.MojoFailureException - if an expected problem (such as a compilation failure) occurs. Throwing this exception causes a "BUILD FAILURE" message to be displayed.