I was getting some unit test failures when running in Maven, but not
in Eclipse.  I think the reasons are important for everyone to
understand.

In Maven, test cases are not allowed to access test classes or
resources from other projects. For example, classes in
uimaj-cpe/src/test/java cannot refer to classes in
uimaj-core/src/test/java, nor can they refer to resources in
uimaj-core/src/test/resources.

Eclipse does not enforce this restriction. In Eclipse, uimaj-cpe has a
project dependency on uimaj-core, and so everything in uimaj-core is
visible to everything in uimaj-cpe. Eclipse doesn't distinguish
between code in src/main and code in src/test in the way that Maven
does.

Because of this differnce it is possible to create Unit tests that run
in Eclipse but fail when run from the Maven command line. To guard
against this, please always run the unit tests in Maven before
committing changes. This is done by executing mvn install from the
uimaj directory.

This has been recorded at
http://cwiki.apache.org/UIMA/differences-between-running-unit-tests-in-eclipse-and-in-maven.html
so I can point people to it when they forget later. :-)

-Adam

Reply via email to