Skip to content

make generated source code IDEA friendly #13297

@zhilu-tang

Description

@zhilu-tang

Is your feature request related to a problem? Please describe.
When importing Nacos project into IDEA, the generated source files under target/generated-sources directory are not automatically recognized by IDEA, causing red squiggles in the IDE. This affects development experience as developers need to manually configure these directories as source roots.

Describe the solution you'd like
Add build-helper-maven-plugin in the root pom.xml to help IDEA automatically recognize the generated source files. The plugin will add target/generated-sources directory to the source roots during project import, which is a Maven standard practice for handling generated sources.

Describe alternatives you've considered

  1. Manually configure source roots in IDEA project settings
  2. Use IDEA's "Mark Directory as Sources Root" feature
  3. Configure through .idea project files

However, these alternatives:

  • Require manual intervention for each developer
  • Need to be reconfigured after project reimport
  • Are IDE-specific and not portable

Additional context
This is a common practice in Maven projects that use code generation (like Protocol Buffers). The build-helper-maven-plugin is widely adopted for this purpose and is considered the standard solution. It works across different IDEs that support Maven integration.

The plugin configuration will be added to the root pom.xml to ensure consistent behavior across all development environments.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions