I have a solution with multiple projects(maven parent pom and a couple of child maven projects). Some of the projects are just a maven project that generates classes from wsdl or xsd using xjc-schema maven plugin. The plugin generates the classes in target/generated-sources folder. Now the other projects in the solution has to use the generated classes but eclipse doesn't recognize the generated classes.
Intellij Idea has no problem with that, it can recognize the generated classes, but I want to use Eclipse.
I tried that with Eclipse Neon and Spring Tool Suite based on Neon.
I tried to refresh, restart etc. with no success. Also tried to add the project with the generated classes to Java Build Path -> Projects of the project that has to use those classes.
您应该将生成的类的文件夹设为源文件夹。
In case that you are already seeing target/generated-sources/... as a source folder in Eclipse but the IDE is still unaware of the generated classes, go to Configure Build Path... and check that there is no Exclusion Pattern set. This was causing the problem in my case.
I had a problem with the setting the target/generated-sources
as source folder. I had a subfolder with generated classes, and but target/generated-sources
set as source folder. Eclipse didn't read the subfolder, though. I removed the target/generated-sources
and added the target/generated-sources/<subfolder>
and it worked.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.