Ok, so I'm getting a little annoyed with Maven 2 right now. The project setup we've got is simple: A "core" project, which is depended on by both a "batch" and "web" project, and an "ear" project which depends on "web". Pretty simple stuff.
Well, since core is used quite a bit, and this is the first time the group is actually doing TDD (test driven development), there's been quite a few mocks created, but mostly in the web project - the batch project is quite simple at the moment.
This current (obsfucated) XML is included in the web pom to include the core project as a dependency:
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>XYZ-core</artifactId>
<version>${project.version}</version>
</dependency>
The pom works if just this is included, as well as the rest of the jar files included. One of the jar files included is the servlet api, 2.4 is the version:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>${version.servlet-api}</version>
<scope>provided</scope>
</dependency>
This is set to scope provided as it will be provided by the web container. No surprises there. With just that in the web pom, it runs the tests and installs no problem.
But, now there's all these mocks in web. Batch can use some of these mocks too. So, naturally I wish to place the core tests as scope test in both the batch and web, so I can move the mocks (which mock core functionality) into core's test so they can be shared among projects. The following snippet (obsfucated) works in the batch project:
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>XYZ-core</artifactId>
<classifier>tests</classifier>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
However, when I add this to the web pom, I get this all over when I try to build web.
XYZ.java:[33,16] cannot resolve symbol symbol : class HttpServletRequest
If it is removed, web builds successfully.
Any ideas? The maven version is 2.0.4. I can attempt an upgrade but this will mean a lot of hassle.
EDIT: The main classes of web are failing to compile with that error (also HttpServletResponse is not being found as well). Even if tests are skipped (-Dmaven.test.skip=true), this error happens.