My Junit test classes unable to sense beans.xml placed in the resource folder.
We are able to compile the Junit test sources properly, but while executing ‘test’ task its failed due to java.lang.NoClassDefFoundError even though both source and test class files are generated.
The test cases are failed which are dependent on beans.xml, others are passed
Below is the project structure :
myproject/src/main/java/ - source files
myproject/src/main/resources/ - included beans.xml
myproject/src/test/java/ - test source files
myproject/src/test/resources/ - included beans.xml
Even though i have set runtime classpath for ‘test’ task in the dependencies, i am facing the same error (NoClassDefFoundError), while executing ‘test’ task.
Are you saying that the NoClassDefFoundError is for a class derived from src/main/java?
If you use the standard conventions of src/main/java, src/main/resources, src/test/java and src/test/resources there shouldn’t be any extra config required.
The following should correctly configure your test classpath.