Hello all,

This is my first post to maven-users mailing list, and from the start, I'm
here to brag about my problems with maven.

I'm having a problem with a TestNG test which runs successfully in
Eclipse(3.4) TestNG plugin(5.8.02), but in Maven (2.0.9) Surefire (2.4.3)
same test fails. It's a spring(2.5.5)-based integration test, it extends
AbstractTestNGSpringContextTests, and through @ContextConfiguration
annotation and its locations attribute it gets configured to load 3 context
files, two of them referenced as "classpath:/com/...." while third one is
from a dependent project/library (test is in one module [war] which depends
on another module [jar] from same multimodule project [pom]) and is
referenced using "classpath*:/com/....." .

Among other things, test makes use of a bean (well) defined in that third
(classpath*) context file. That referenced bean is injected to the test
through use of autowiring (@Autowired). Problem is that that bean doesn't
get found and test initialization fails. Log doesn't print that problematic
context failed to load, just any of it's beans aren't accessible/registered.
Btw, if I leave out * from classpath* spring reports that it couldn't load
context file as it is missing.

I've tried substituting autowiring with getting bean by name "manually" in
setUp method through this.applicationContext.getBean but this also failed.

Then I've thought that it has to do with loader used to load context's, so I
explicitly specified loader attribute of @ContextConfiguration annotation to
be GenericXmlContextLoader.class. This didn't work either. In all of these
tweaks, test would continue to run well in eclipse testng plugin, but it
fails in maven (both external and m2eclipse internal).

Because I use reportng, I though it interfered with the test somehow but
removing reportng didn't help as well as removing parallel mode for test
execution.


With this I ran out of options, with you guys being my last resort. Any
comments and pointers are welcome!

Thanks in advance!

Regards,
Stevo.

Reply via email to