I can give you an example which results in the same problem, but it may not give you an answer to your question. (Additionally, in this example, I'm using my Maven 3 knowledge, which may not apply for Maven 2.)
In a multi-module maven project (contains modules A and B, where B depends on A), you can add also a test dependency of A in B.
This dependency in B may look as follows:
<dependency>
<groupId>com.foo</groupId>
<artifactId>A</artifactId>
<classifier>tests</classifier>
<type>test-jar</type> <!-- I'm not sure if there is such a thing in Maven 2, but there is definitely a way to achieve such dependency in Maven 3. -->
<scope>test</scope>
</dependency>
(For more information refer to https://maven.apache.org/guides/mini/guide-attached-tests.html)
Note that project Ausually produces a secondary artifact with a classifier tests (i.e. .../com/foo/A/<version>/A-<version>-tests.jar) where the test classes and test resources are located inside.
If you build project A with -Dmaven.test.skip=true, you will get a dependency resolution error when building B unless A's test artifact is found in your local repo or remote repositories. The reason is that the test classes of A were neither compiled nor the tests artifact of A was produced.
However, if you build A with -DskipTests its tests artifact will be produced (though the tests won't run) and the dependency in B will be resolved successfully.