Sorry, please ignore previous email. The problem is that my unit test is
explicitly looking for junit via the system classloader. Of course
surefire is loading junit via a custom classloader.

Regards,

Simon


On Tue, 2006-07-25 at 10:34 +1200, Simon Kitching wrote:
> Hi,
> 
> I'm trying to write a maven2 pom.xml for commons-logging. Running the
> unit tests is a little tricky, because there are lots of tests that
> explicitly configure their own classpath, using the artifacts created
> during the build process.
> 
> I've therefore got a set of unit tests that run in the normal "test"
> phase, selected by configuring the surefire plugin with <includes>.
> These work fine.
> 
> I've then used <executions> to bind surefire to the "integration-test"
> phase as well. Unfortunately when surefire runs at this stage, junit
> does not appear to be on the classpath (NoClassDefFound occurs
> for ...). 
> 
> Any ideas how to get junit visible to the junit tests at
> integration-test phase?
> 
> I've tried marking the junit dependency as scope=test, scope=provided,
> and normal (no scope definition). No change.
> 
> I've tried setting surefire's "classpathElements" attribute in the
> execution section, but get "Cannot override read-only parameter:
> classpathElements in  goal: surefire:test".
> 
> Note also that I've defined the project dependencies in two profiles
> "build" and "use", as commons-logging must be built against all its
> dependencies, but they are all optional at runtime. It appears that
> maven2 doesn't put optional dependencies on the classpath at "compile"
> phase. I don't think this is related to the original problem though.
> 
> Attached is a cut-down version of the pom. Any advice welcomed.
> 
> Thanks,
> 
> Simon
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to