【问题标题】:cannot find symbol on file already excluded在已排除的文件上找不到符号
【发布时间】:2021-03-29 15:42:03
【问题描述】:

我不明白为什么在已从构建路径中排除的文件上出现“找不到符号”错误。

所有对排除类的任何类或方法的引用都已被注释掉。 没有错误或重要警告:
问题/警告列表:

项目构建排除:

编译输出:

[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] C:\Users\dorr\git\ddr-ingest\src\main\java\com\biogen\ddr\ingest\model\TableBuilderInstruction.java:[54,32] error: cannot find symbol
[ERROR]   symbol:   method getTableByID(UUID)
  location: variable ddrInterface of type DomainInterfaceImpl
C:\Users\dorr\git\ddr-ingest\src\main\java\com\biogen\ddr\ingest\model\TableBuilderInstruction.java:[128,43] error: cannot find symbol
[ERROR]   symbol:   method getSourceDDRColumn()
  location: variable datapointSource of type DatapointSource
C:\Users\dorr\git\ddr-ingest\src\main\java\com\biogen\ddr\ingest\model\TableBuilderInstruction.java:[147,67] error: cannot find symbol
[ERROR]   symbol:   method getArithmeticDatapoints()
  location: variable datapointSource of type DatapointSource
C:\Users\dorr\git\ddr-ingest\src\main\java\com\biogen\ddr\ingest\model\TableBuilderInstruction.java:[151,68] error: cannot find symbol
[ERROR]   symbol:   method getSourceDDRColumn()
  location: class DatapointSource
C:\Users\dorr\git\ddr-ingest\src\main\java\com\biogen\ddr\ingest\model\TableBuilderInstruction.java:[152,64] error: cannot find symbol
[INFO] 5 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.489 s
[INFO] Finished at: 2021-03-29T11:33:41-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project ingest: Compilation failure: Compilation failure: 
[ERROR] C:\Users\dorr\git\ddr-ingest\src\main\java\com\biogen\ddr\ingest\model\TableBuilderInstruction.java:[54,32] error: cannot find symbol
[ERROR]   symbol:   method getTableByID(UUID)
[ERROR]   location: variable ddrInterface of type DomainInterfaceImpl
[ERROR] C:\Users\dorr\git\ddr-ingest\src\main\java\com\biogen\ddr\ingest\model\TableBuilderInstruction.java:[128,43] error: cannot find symbol
[ERROR]   symbol:   method getSourceDDRColumn()
[ERROR]   location: variable datapointSource of type DatapointSource
[ERROR] C:\Users\dorr\git\ddr-ingest\src\main\java\com\biogen\ddr\ingest\model\TableBuilderInstruction.java:[147,67] error: cannot find symbol
[ERROR]   symbol:   method getArithmeticDatapoints()
[ERROR]   location: variable datapointSource of type DatapointSource
[ERROR] C:\Users\dorr\git\ddr-ingest\src\main\java\com\biogen\ddr\ingest\model\TableBuilderInstruction.java:[151,68] error: cannot find symbol
[ERROR]   symbol:   method getSourceDDRColumn()
[ERROR]   location: class DatapointSource
[ERROR] C:\Users\dorr\git\ddr-ingest\src\main\java\com\biogen\ddr\ingest\model\TableBuilderInstruction.java:[152,64] error: cannot find symbol
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

【问题讨论】:

  • 你为什么要从编译中排除源代码?
  • 因为客户在最后一刻决定不在部署中包含某个功能。

标签: java eclipse compiler-errors


【解决方案1】:

您的第二个屏幕截图显示您已在 Eclipse 中配置了排除模式,但您的第三个屏幕截图显示了针对您尝试排除的源的编译错误,但您使用的是 Maven,而不是 IDE。

您需要在 pom.xml 文件中为 Maven 中的编译器插件配置排除模式。这在此处进行了描述Maven: excluding java files in compilation

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-27
    • 2015-09-06
    • 2011-06-17
    • 2012-02-21
    相关资源
    最近更新 更多