[英]Eclipse doesn't see classes from target/generated-sources
I have a solution with multiple projects(maven parent pom and a couple of child maven projects).我有一个包含多个项目的解决方案(maven 父 pom 和几个子 maven 项目)。 Some of the projects are just a maven project that generates classes from wsdl or xsd using xjc-schema maven plugin.
一些项目只是一个 maven 项目,它使用 xjc-schema maven 插件从 wsdl 或 xsd 生成类。 The plugin generates the classes in target/generated-sources folder.
该插件在 target/generated-sources 文件夹中生成类。 Now the other projects in the solution has to use the generated classes but eclipse doesn't recognize the generated classes.
现在解决方案中的其他项目必须使用生成的类,但 eclipse 无法识别生成的类。
Intellij Idea has no problem with that, it can recognize the generated classes, but I want to use Eclipse. Intellij Idea 没有问题,它可以识别生成的类,但我想使用 Eclipse。
I tried that with Eclipse Neon and Spring Tool Suite based on Neon.我用 Eclipse Neon 和基于 Neon 的 Spring Tool Suite 尝试过。
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.
还尝试将带有生成类的项目添加到必须使用这些类的项目的 Java Build Path -> Projects。
您应该将生成的类的文件夹设为源文件夹。
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.如果您已经看到 target/generated-sources/... 作为 Eclipse 中的源文件夹,但 IDE 仍然不知道生成的类,请转到配置构建路径...并检查是否没有设置排除模式. This was causing the problem in my case.
这导致了我的问题。
I had a problem with the setting the target/generated-sources
as source folder.我在将
target/generated-sources
为源文件夹时遇到问题。 I had a subfolder with generated classes, and but target/generated-sources
set as source folder.我有一个包含生成类的子文件夹,但
target/generated-sources
设置为源文件夹。 Eclipse didn't read the subfolder, though.但是,Eclipse 没有读取子文件夹。 I removed the
target/generated-sources
and added the target/generated-sources/<subfolder>
and it worked.我删除了
target/generated-sources
并添加了target/generated-sources/<subfolder>
并且它起作用了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.