I am following this Contract first using CXF tutorial.
All was going well, including generating sources from the WSDL, using build-helper-maven-plugin but when time came to "implement the service", i.e. move the generated RegistryResourceImpl.java to the normal source folder src/main/java, Eclipse started complaining about some symbols (like the interface RegistryResource) not being recognized.
Realizing that the normal src/main/java folder is assigned a different package name, I simply added in the RegistryResourceImpl.java the import for the package where RegistryResource.java belongs:
import com.yourcompany.sample.ns.RegistryResource;
But Eclipse in its current project configuration appears to be blind to com.yourcompany.sample.ns, not knowing where to find it.
I tried finding an option in the Build Path to point to the generated sources but none of what I tried helped.
I have a feeling I am missing something very trivial but what is it?
Also, shouldn't m2e (Maven plugin for Eclipse) already handle that kind of moving implementation files automatically?
Update (after trying @Patrick's suggested solution):
target/generated/src/main/javadoesn't exist, but checking the "Create new folder" box, I was able to create it.- However, upon pom.xml > Run As >
Maven clean, it gets deleted (so needs to be re-created after every clean???) - If not re-creating after clean, doing pom.xml > Run As >
Maven install, creates the generates source under a totally different tree:generated-sources/cxf/com/yourcompany/sample/ns. Why??? - Yet, the
RegistryResourceImpl.javamodule is still automatically created undertarget/generated sources. At this point, I no longer see complaints about "unresolved package/imports/symbols" (weird). - But... as soon as it is being moved to non-target folder/package, i.e. com.yourcompany.sample.ns under src/main/java, "import com.yourcompany.sample.ns.RegistryType;" cannot be resolved again!
On the other hand, if I try to add as a "source folder" the actual generated path generated-sources/cxf/com/yourcompany/sample/ns (instead of the irrelevant/non-existent target/generated/src/main/java, the generated tree under target is moved (deleted) to under /src/main/java. I don't understand this behavior of Eclipse.
Lastly, even when I do the Maven > Update Project suggested here, thereby getting rid the "Maven 2 project error icon", the RegistryResourceImpl.java module still shows unresolved symbols, although the entire project build perfectly fine!
What could explain this?
Is it possible that the build-helper-maven-plugin is incomplete or even broken?
Is there a way to make CXF + build-helper-maven-plugin work harmoniously with Eclipse so that I don't see those disturbing red underlines of "unresolved symbols" even when the project builds successfully?