You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@iotdb.apache.org by "Eric Pai (Jira)" <ji...@apache.org> on 2021/03/10 08:49:00 UTC

[jira] [Created] (IOTDB-1198) Add generated-sources as source folder

Eric Pai created IOTDB-1198:
-------------------------------

             Summary: Add generated-sources as source folder
                 Key: IOTDB-1198
                 URL: https://issues.apache.org/jira/browse/IOTDB-1198
             Project: Apache IoTDB
          Issue Type: Task
          Components: Others
            Reporter: Eric Pai
             Fix For: master branch


h1. 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*.
h1. 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
{code:java}
${project.build.directory}/generated-sources/antlr4{code}
 instead of
{code:java}
${project.build.outputDirectory}/../generated-sources/antlr4{code}
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]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)