One way to get this error in Eclipse Eclipse:
- Define a class
Ainsrc/test/java. - Define another class
Binsrc/main/javathat uses classA.
Result : Eclipse will compile the code, but mavenMaven will give "Cannot find symbol".
Underlying cause : Eclipse is using a combined build path for the main and test trees. Unfortunately, it does not support using different build paths for different parts of an Eclipse project, which is what Maven requires.
Solution :
- Don't define your dependencies that way; i.e., don't make this mistake.
- Regularly build your codebase using Maven so that you pick up this mistake early. One way to do that is to use a CICI server.