Note that there are some explanatory texts on larger screens.

plurals
  1. POMaven - Tweaking the phase where to run a plugin declared in the reporting section
    primarykey
    data
    text
    <p>I am trying to tweak the phase when a maven plugin execution will run in maven-2. </p> <p>My specific issue is with attempting to run the <code>cobertura:instrument</code> step bound to the lifecycle phase <code>process-test-classes</code>, so that it doesn't conflict with other plugins that use aspectj (and remove instrumentation code, thus generating a coverage report of 0%). But my question is more generic.</p> <p>Within the deafault lifecycle, I have managed to do that by adding an executions section in my plugin declaration:</p> <pre><code>&lt;build&gt; &lt;plugins&gt; ... &lt;plugin&gt; &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt; &lt;artifactId&gt;cobertura-maven-plugin&lt;/artifactId&gt; &lt;version&gt;2.4&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;instrument-late&lt;/id&gt; &lt;phase&gt;process-test-classes&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;instrument&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; ... </code></pre> <p>This way, when I run <code>mvn test</code> everything works fine, cobertura:instrument is run at the phase I want, classes get instrumented, tests run with instrumented classes, etc. This is summarized output:</p> <pre><code>[INFO] [clean:clean {execution: default-clean}] [INFO] [buildnumber:create {execution: default}] [INFO] [native2ascii:native2ascii {execution: native2ascii-utf8}] [INFO] [native2ascii:native2ascii {execution: native2ascii-8859_1}] [INFO] [resources:resources {execution: default-resources}] [INFO] [compiler:compile {execution: default-compile}] [INFO] [jar:jar {execution: lib}] [INFO] [resources:testResources {execution: default-testResources}] [INFO] Preparing hibernate3:hbm2ddl [WARNING] Removing: hbm2ddl from forked lifecycle, to prevent recursive invocation. [INFO] [buildnumber:create {execution: default}] [INFO] Change the default 'svn' provider implementation to 'javasvn'. [INFO] Checking for local modifications: skipped. [INFO] Updating project files from SCM: skipped. [INFO] Storing buildNumber: 2082 at timestamp: 1299861835678 [INFO] Storing buildScmBranch: trunk [INFO] [native2ascii:native2ascii {execution: native2ascii-utf8}] [INFO] [native2ascii:native2ascii {execution: native2ascii-8859_1}] [INFO] [resources:resources {execution: default-resources}] [INFO] [hibernate3:hbm2ddl {execution: default}] [INFO] [compiler:testCompile {execution: default-testCompile}] [INFO] [jar:test-jar {execution: tests}] [INFO] [dbunit:operation {execution: test-compile}] [INFO] [cobertura:instrument {execution: instrument-late}] [INFO] [surefire:test {execution: default-test}] [INFO] Surefire report directory: /home/carles/dev/ism4web/portasigma/portasigma-web/target/surefire-reports ... Results : Tests run: 62, Failures: 0, Errors: 0, Skipped: 0 Flushing results... Flushing results done Cobertura: Loaded information on 74 classes. Cobertura: Saved information on 74 classes. [INFO] [dbunit:operation {execution: test}] </code></pre> <p>However, when I do <code>mvn site</code> I seem to have no control over the execution phase for the plugin. My reporting section contains:</p> <pre><code>&lt;reporting&gt; &lt;plugins&gt; ... &lt;plugin&gt; &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt; &lt;artifactId&gt;cobertura-maven-plugin&lt;/artifactId&gt; &lt;version&gt;2.4&lt;/version&gt; &lt;/plugin&gt; </code></pre> <p>And the output of <code>mvn site</code> (summarized) says:</p> <pre><code>[INFO] [clean:clean {execution: default-clean}] [INFO] [buildnumber:create {execution: default}] [INFO] [native2ascii:native2ascii {execution: native2ascii-utf8}] [INFO] [native2ascii:native2ascii {execution: native2ascii-8859_1}] [INFO] [resources:resources {execution: default-resources}] [INFO] [compiler:compile {execution: default-compile}] [INFO] [jar:jar {execution: lib}] [INFO] [cobertura:instrument {execution: default-instrument}] [INFO] [hibernate3:hbm2ddl {execution: default}] [INFO] [compiler:testCompile {execution: default-testCompile}] [INFO] [jar:test-jar {execution: tests}] [INFO] [dbunit:operation {execution: test-compile}] [INFO] [cobertura:instrument {execution: instrument-late}] [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Unable to prepare instrumentation directory. Embedded error: source and destination are the same directory. </code></pre> <p>Instrument is called twice, one at the (I presume) default phase defined by the plugin, and another one at my redefined phase. I guess that comes from the plugin running during as part of the site lifecycle.</p> <p>THE QUESTION: I haven't found how to tweak the plugin execution within the reporting section / site lifecycle. Any hints?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload