8

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,479
  • 2
  • 25
  • 42
user2030632
  • 101
  • 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

18

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
  • 7,430
  • 5
  • 28
  • 44
Alexander
  • 2,617
  • 3
  • 30
  • 33
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
  • 26,353
  • 12
  • 100
  • 121
shubham
  • 89
  • 7