Eclipse Build Path Nesting Errors
I wanted to throw in a non-mavenish answer to this thread.
Due to version control and strict directory structure reasons, I was unable to follow Acheron's answer (the best answer) of doing something similar to removing src/
and adding src/main/java
and src/test/java
to the build path.
I had actually been off-and-on battling this nested build path issue for a couple weeks. The answer to the problem is hinted in the error message:
To enable the nesting exclude 'main/' from 'final/src'
Fix
In your build path, you need to edit your Inclusion and Exclusion Patterns
by clicking on Excluded: (None)
and then Edit...
:
- Go to the navigator and press right click on the project
- Build Path
- Configure Build Path
- Source (tab)
There you can add main/webapp/WEB-INF/classes
as an Exclusion Pattern
. Then it should allow you to add main/webapp/WEB-INF/classes
to the build path as a separate source folder.
I had the same problem even when I created a fresh project.
I was creating the Java project within Eclipse, then mavenize it, then going into java build path properties removing src/
and adding src/main/java
and src/test/java
. When I run Maven update it used to give nested path error.
Then I finally realized -because I had not seen that entry before- there is a <sourceDirectory>src</sourceDirectory>
line in pom file written when I mavenize it. It was resolved after removing it.
Here is a simple solution:
- Right click the project >> properties >> build path;
- In Source tab, Select all the source folders;
- Remove them;
- Right click on project, Maven >> Update the project.