简体   繁体   English

IntelliJ Idea 生成源码

[英]IntelliJ Idea generated source

Just new to IntelliJ Idea.刚刚接触 IntelliJ Idea。 I have maven project which has few generated source java files.我有 Maven 项目,其中生成的源 Java 文件很少。 When I import that project Idea complaints about generated source files are missing but I can see those files under target/generated-sources .当我导入该项目时,关于生成的源文件的 Idea 投诉丢失,但我可以在target/generated-sources下看到这些文件。 How can I add those files in the classpath.如何在类路径中添加这些文件。

You can go to Files > Project Structure and then choose your module and on the sources tab you can navigate to the generated-sources dir and click Mark as > Sources :您可以转到Files > Project Structure ,然后选择您的模块,在源选项卡上,您可以导航到generated-sources目录并单击Mark as > Sources

标记为来源 - IDEA

Additionally, folder could be assigned to the specific type from the Project panel via mark directory as context menu.此外,可以通过mark directory as上下文菜单从Project面板将文件夹分配给特定类型。

To have maven do it automatically, look here: How to create folder for generated sources in Maven?要让 Maven 自动执行此操作,请查看此处: 如何在 Maven 中为生成的源创建文件夹?

if you are using Springboot Application.如果您使用的是 Springboot 应用程序。 just follow the step in IntelliJ.只需按照 IntelliJ 中的步骤操作即可。 step 1. right-click on project folder.步骤 1. 右键单击​​项目文件夹。 step 2. select maven.步骤2.选择maven。 step 3. generate source and update the project folder步骤 3. 生成源并更新项目文件夹

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM