9

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.

Abhishek Jain
  • 3,562
  • 2
  • 26
  • 44
user2030632
  • 111
  • 1
  • 1
  • 7
  • Try this solution, it may resolve your issue. [click here for the solution](https://stackoverflow.com/a/47278829/7855267) – Asad Abdin Nov 14 '17 at 07:24

2 Answers2

20

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:

Mark as sources - IDEA

Additionally, folder could be assigned to the specific type from the Project panel via mark directory as context menu.

To have maven do it automatically, look here: How to create folder for generated sources in Maven?

nircraft
  • 8,242
  • 5
  • 30
  • 46
Alexander
  • 2,925
  • 3
  • 33
  • 36
2

If you are using Springboot Application.

just follow the step in IntelliJ.

  1. Right-click on project folder.
  2. Select maven.
  3. Generate source and update the project folder
Maytham Fahmi
  • 31,138
  • 14
  • 118
  • 137
shubham
  • 89
  • 7