I am running eclipse oxygen (release 4.7.3a) with maven plugin m2e (1.8.3.20180227) and java 8 (jdk1.8.0_172)
Updated eclipse to Version: 2019-03 (4.11.0), m2e 1.11.0.20190220-2119, java version unchanged. Same behavior persists.
I have a project with a module.
The module has /src/main/java
and src/test/java
The junit
dependency is test scope.
When I run maven install I get errors during compile
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project something: Compilation failure: Compilation failure:
[ERROR] /C:/Users/me/git/base/module/src/test/java/com/company/redacted/db/IsAdminQueryTest.java:[3,24] package org.junit does not exist
If I change the scope of junit
to default it compiles and runs fine.
A perhaps related symptom If I run Maven -> Update Project
, I get an error:
Cannot nest 'module/src/main/resources' inside 'module/src/'. To enable nesting exclude 'main/' from 'module/src/'
However module/src
is not a java source folder.
from the maven log during the compile stage when running with -e -X
.
Note the test in the path
[DEBUG] Stale source detected: C:\Users\me\git\base\module\src\main\java\com\company\redacted\db\IsAdminQuery.java
[DEBUG] Stale source detected: C:\Users\ms\git\base\module\src\test\java\com\company\redacted\db\IsAdminQueryTest.java
Where should I look for the bad config?
Update after upgrade I had changed the scope of junit and mockito to global to work around this problem. When I changed them back to scope: test the test case started having dependency issues/failure to compile. Clearly eclipse/maven doesn't know my test classes are test classes.
I have installed maven directly on my pc. Running mvn install from the command line has the same issues as running in eclipse.