Maven 3 and JUnit 4 compilation problem: package org.junit does not exist

@Dennis Roberts: You were absolutely right: My test class was located in src/main/java. Also the value of the “scope” element in the POM for JUnit was “test”, although that is how it is supposed to be. The problem was that I had been sloppy when creating the test class in Eclipse, resulting in it being created in src/main/java insted of src/test/java. This became easier to see in Eclipse’s Project Explorer view after running “mvn eclipse:eclipse”, but your comment was what made me see it first. Thanks.

Leave a Comment