Hi

I think I found a bug in Maven when working in forked lifecycle, like
"cobertura" lifecycle.
Look at these two example projects:
http://sbt-compiler-maven-plugin.googlecode.com/svn/tmp/bug-in-forked-lifecycle/

There are logs from "mvn test -X", "mvn cobertura:cobertura -X" and "mvn
site -X" executions commited.

The problem is the plugin configuration parameter values are initialized
to values set for parameters with the same name in previous plugin.

In java example "maven-surefire-plugin" is replaced by
"scalatest-maven-plugin" as testing plugin so there is "skipTests=true"
added to Surefire configuration.
When executing "test" Surefire skips test execution and ScalaTest
executes, as expected.
When executing "cobertura:cobertura" or "site" Surefire skips test
execution and ScalaTest skips as well because it's
"skipTests" prameter value is now "true". Why?

In scala example things are even more weird.
There is the same logic as in java example (ScalaTest replaces Surefire)
and additionally sbt-compiler-maven-plugin
replaces maven-compiler-plugin. In standard compiler plugin
"skipMain=true" to skip source files compilation and "skip=true"
to skip test source files compilation. Situation here is similar to
Surefire-ScalaTest conflict, both plugins have the same "skipMain" option
(SBTCompiler has "skipTest" parameter for skipping test sources
compilaiton and Compiler has "skip" parameter so no conflict here).

When executing "compile" standard Compiler skips compilation and
SBTCompiler compiles sources.
I was expectiong problems in "cobertura" lifecycle (when executing
"site" or "cobertura:cobertura"), but compilation works here!
Test execution does not work, like in previous example.

Why such difference? I don't know.
There is "cobertura:instrument" execution In "cobertura" lifecycle in
"process-classes" phase, so after compilation, but before testing.
Maybe this execution is the source of the problem.

Tested with different versions of Maven, from 2.2.1 to latest 3.2.3.
Always the same behaviour.

I made one more test, renamed "skipTest" parameter in SBTCompiler to
"test" (in my local svn copy) to have parameter "conflict"
with standard Compiler in testCompile mojo (executed after
"cobertura:instrument").
Surprisingly, there is no "conflict", so maybe this has nothing to do
with "cobertura:instrument" mojo execution.

Summary:
In forked "cobertura" lifecycle (in "mvn site" or "mvn
cobertura:cobertura" executions):
- "skipTests" configuration parameter value of ScalaTest plugin gets
overwritten by value of "skipTests" parameter defined for Surefire plugin,
- "skipMain and "skip" configuration parameter values of SBTCompiler
don't get overwritten by values of "skipMain and "skip" parameters
defined for standard Compiler plugin.

Worse, I didn't a workaround.

Could someone help me solve this problem?

Regards
Grzegorz Slowikowski

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to