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/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.
make two folders:
final/src/ to store the source java code, and
you cannot put the source and the webroot together. i think you may misunderstand your teacher.
for eclipse compiler to work properly you need to remove final/src from the source path and add final/src/main/java instead. this may also solve your problem as now the build directory won't be inside the java source folder.
it depends on which folder one is telling "use as source folder" to. in the structure on the picture if one says it to the folder "target" or "generated", he gets the "nested" error. but on "cxf" folder, which is the last, mentioned in the pom.xml's 'plugin' section and where from the package structure begins (as shown on .wsdl file), i.e. - the right folder to do it 'source' one, then there is no error
this started taking me down a huge rabbit hole of fixing glitches with eclipse, however i just deleted the project from eclipse and reimported it to fix it.
got similar issue. did following steps, issue resolved:
- remove project in eclipse.
- delete .project file and . settings folder.
- import project as existing maven project again to eclipse.
you have to separate your sources and your target directory where the build output goes. it's also important to note that no class files ever can end up in the source directory. this is not against your professor's advice - actually he's promoting the maven standard source structure going for ./src/main/java and ./src/main/webapp. the second one should hold eg. the mandatory web-inf/web.xml file but you will never put actual classes there.
what you need to change is your target directory. i suggest going with the same standards and choosing the name "./target" for this. all the built files will go in here and packaging that up will result a correct deployable artifact. should you migrate to using maven later, it'll also help doing this in a scripted, repeatable way.
hope that clears up your issue.
the accepted solution didn't work for me but i did some digging on the project settings.
the following solution fixed it for me at least if you are using a dynamic web project:
- right click on the project then properties. (or alt-enter on the project)
- under deployment assembly remove "src".
you should be able to add the src/main/java. it also automatically adds it to deployment assembly.
caveat: if you added a src/test/java note that it also adds it to deployment assembly. generally, you don't need this. you may remove it.
in my case i have a gradle nature project in eclipse, the problem was in a
build.gradle, where this
sourcesets is specified:
this seems to works well with intellij,however seems than eclipse doesn't like nest
src/resources. in eclipse i must change it to:
i had the same issue and correct answer above did not work for me. what i did to resolve it was to go to
build path->configure build path and under the source tab i removed all the sources (which only had one source) and reconfigured them from there. i ended up removing the project from eclipse and import the maven project again in order to clear up the error.
from the libraries tab:
eclipse -> right click on project name in sidebar -> configure build path -> libraries
remove your web app libraries:
click on "web app libraries" -> click "remove"
add them back in:
click "add library" -> click to highlight "web app libraries" -> click "next" -> confirm your desired project is the selected option -> click "finish"
highlighting "web app libraries":
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.
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/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'
in your build path, you need to edit your
inclusion and exclusion patterns by clicking on
excluded: (none) and then
- 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.
- Eclipse Build Path Nesting Errors
- Project cannot be built until build path errors are resolved eclipse
- Java build path errors on Eclipse
- Build path errors while switching Eclipse versions
- Java Eclipse Build Path Errors Maven
- Importing a clone from github into Eclipse and build path errors
- Eclipse 3.5 + ADT: build path errors
- Eclipse -- SharedClasses has build path errors
- How to configure Eclipse build path to use Maven dependencies?
- The project cannot be built until the build path errors are resolved.
- Eclipse "this compilation unit is not on the build path of a java project"
- Eclipse can't find XML related classes after switching build path to JDK 10
- Successful build in Maven still showing errors in Eclipse
- ClassNotFoundException when using User Libraries in Eclipse build path
- Set Build path in Eclipse for ndk program
- Eclipse IDE - Error: Build path specifies execution environment Java SE 1.7
- How can I add build path items to Eclipse 3.5 using relative paths?
- Maven clean + build causes project in Eclipse to show errors until clean in Eclipse
- export/import Eclipse build path
- Eclipse Oxygen - The project was not built since its build path is incomplete
- Error in Eclipse: "The project cannot be built until build path errors are resolved"
- Eclipse removing a test folder from the build path
- Eclipse Java project build path using variables
- Eclipse : Project properties don't show Build Path
- NoClassDefFoundError in Eclipse when adding project in build path
- Adding header files to eclipse build path for C++
- Eclipse maven build path issue in case of custom sourceDirectory
- How do I set the Eclipse build path and class path from an Ant build file?
- A cycle was detected in the build path of project ... eclipse
- java eclipse build path options question
More Query from same tag
- config.ini setup for headless eclipse
- android project folder error in eclipse
- Should the following code compile under Java 1.8
- Eclipse becomes stuck on "starting activity" when sending application to device. How to solve this?
- Error in a ManyToMany Relationship on Hibernate-JPA
- Android Studio Appcompat conflict with ActionBarSherlock
- Questions about source control etiquette
- Eclipse Start Weblogic in debug Mode error : “Failed to connect to remote VM”
- Can I hot-deploy to a remote install of Tomcat?
- How to select an individual cell in a SWT Tree with a TreeCursor
- How to: add a class docstring with Eclipse/Pydev via keyboard shortcut?
- When starting eclipse using sudo, avd is stored in the wrong folder
- Confused about exporting jars for a project with may packages and main() without including the whole lot
- Setup GWT and eclipse on windows
- Could not get JDBC Connection; nested exception is java.sql.SQLException - junit eclipse
- How to solve widget disposed exception?
- Eclipse adds an exclusion pattern of ** to src/main/resources: how to read a resource file?
- Performance measuring
- m2eclipse - after pom and dependencies definition - no libraries on classpath / Maven Dependencies
- How to create a variable of type poco::Date::Date and add a particular date?
- Problems with importing Android platform classes
- Eclipse Activiti Designer Custom Extension
- Use emacs or vim syntax highlighting files (e-lisp, vimrc) in Eclipse
- How does Eclipse manage different running Java classes
- Grails - Class "org.grails.tomcat.TomcatLoader" was not found in the CLASSPATH
- Writing an XSD schema to validate any XML file as valid
- android.view.InflateException error?
- Pushing code from Maven builds into Eclipse plugins
- Seam Runtime error in Eclipse
- Java Eclipse java.lang.UnsatisfiedLinkError JNI loading dll and C code