java IntelliJ Idea 生成源码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29290074/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
IntelliJ Idea generated source
提问by user2030632
Just new to IntelliJ Idea. I have maven project which has few generated source java files.
When I import that project Idea complaints about generated source files are missing but I can see those files under target/generated-sources. How can I add those files in the classpath.
刚刚接触 IntelliJ Idea。我有 Maven 项目,其中生成的源 Java 文件很少。当我导入该项目时,关于生成的源文件的 Idea 投诉丢失,但我可以在target/generated-sources. 如何在类路径中添加这些文件。
回答by Alexander
You can go to Files > Project Structureand then choose your module and on the sources tab you can navigate to the generated-sourcesdir and click Mark as > Sources:
您可以转到Files > Project Structure然后选择您的模块,在源选项卡上,您可以导航到generated-sources目录并单击Mark as > Sources:


Additionally, folder could be assigned to the specific type from the Projectpanel via mark directory ascontext menu.
此外,可以Project通过mark directory as上下文菜单从面板将文件夹分配给特定类型。
To have maven do it automatically, look here: How to create folder for generated sources in Maven?
要让 Maven 自动执行此操作,请查看此处:如何在 Maven 中为生成的源创建文件夹?
回答by shubham
if you are using Springboot Application. just follow the step in IntelliJ. step 1. right-click on project folder. step 2. select maven. step 3. generate source and update the project folder
如果您使用的是 Springboot 应用程序。只需按照 IntelliJ 中的步骤操作即可。步骤 1. 右键单击项目文件夹。步骤2.选择maven。步骤 3. 生成源并更新项目文件夹

