I have a Maven project in Netbeans 7.1 IDE.
I'd like to add the same dependency to both Dependencies
and Test Dependencies
.
Adding to one removes it from the other.
Duplicating the dependency in pom.xml and including in one of them:
<scope>test</scope>
..doesn't work either.
Help!
More Details:
Assume I have projects MyProject
and MyDependency
.
MyProject
contains MyDependency
as a default scope (i.e. compile
scope) dependency:
<dependencies>
<dependency>
<groupId>my.group.id</groupId>
<artifactId>AnArtifactId</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
MyProject
contains several classes in the Source Packages
folder (i.e. MyProject/src/main/...
) which reference classes within MyDependency
source packages. These work perfectly; Netbeans shows no red error flags and those classes compile successfully.
MyProject
contains several classes in the Test Packages
folder (i.e. MyProject/src/test/...
) which reference classes within MyDependency
test packages. Netbeans displays red error flags in MyProject
for these references.
MyDependency
has been cleaned, built and stored in local Maven repo using mvn clean install -DskipTests
. Running the same command for MyProject
causes errors within the test classes only; the non-test classes compile fine.