Uploaded image for project: 'Apache IoTDB'
  1. Apache IoTDB
  2. IOTDB-1198

Add generated-sources as source folder

    XMLWordPrintableJSON

Details

    Description

      Description

      The generated source files in thirft/target/generated-sources and antlr/target/generated-sources can't be auto discovered by IDEs like VSCode and IntelliJ IDEA.

      In IDEA, we can solve this by following the instructions in https://iotdb.apache.org/Development/ContributeGuide.html#_2-iotdb-debugging-method.

      However, this can't be applied in VSCode Java plugin because adding a folder to Java source path is forbidden in a maven project. The error output is Unsupported operation. Please use pom.xml file to manage the source directories of maven project.

      Solution

      Use build-helper-maven-plugin to add the folder to sources in generate-sources phase.

      Influenced modules:

      • antlr
      • thrift

      If this PR is accepted, I will submit another one to update the docs.

      Note

      We must use

      ${project.build.directory}/generated-sources/antlr4

       instead of

      ${project.build.outputDirectory}/../generated-sources/antlr4

      The resaons are:

      1. Although the two paths refer to the same dictionary, their string representations are different. e.g. antlr/target/classes/../generated-sources/antlr4 and antlr/target/generated-sources/antlr4.
      2. It seems that javac of JDK8 will not simplify the source path, thus a duplicate class compilcation error occurs.
      3. JDK11 and 15 fixed this issue(I guess).

      See this CI result: https://github.com/apache/iotdb/actions/runs/635878512

      Attachments

        Issue Links

          Activity

            People

              ericpai Eric Pai
              ericpai Eric Pai
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 24h
                  24h
                  Remaining:
                  Remaining Estimate - 24h
                  24h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified