SelectExpressionItem cannot be resolved 报错分析
# 报错背景与现象
在使用 Bigtop 编译 CloudBeaver 相关组件时,部分用户会遇到如下类似的 Java 类型无法解析、方法不存在等异常:
[ERROR] SelectExpressionItem cannot be resolved to a type
[ERROR] /opt/modules/bigtop/build/cloudbeaver/rpm/BUILD/dbeaver/plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/SQLQuery.java:[303]
[ERROR] !selectBody.isForUpdate();
[ERROR] ^^^^^^^^^^^
[ERROR] The method isForUpdate() is undefined for the type PlainSelect
[ERROR] /opt/modules/bigtop/build/cloudbeaver/rpm/BUILD/dbeaver/plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/SQLQuery.java:[525]
[ERROR] SelectBody selectBody = ((Select) statement).getSelectBody();
[ERROR] ^^^^^^^^^^
[ERROR] SelectBody cannot be resolved to a type
[ERROR] /opt/modules/bigtop/build/cloudbeaver/rpm/BUILD/dbeaver/plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/SQLQuery.java:[527]
[ERROR] return plainSelectBody.isForUpdate() || plainSelectBody.getIntoTables() != null;
[ERROR] ^^^^^^^^^^^
[ERROR] The method isForUpdate() is undefined for the type PlainSelect
[ERROR] /opt/modules/bigtop/build/cloudbeaver/rpm/BUILD/dbeaver/plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/SQLSelectItem.java:[43]
[ERROR] if (item instanceof SelectExpressionItem) {
[ERROR] ^^^^^^^^^^^^^^^^^^^^
[ERROR] SelectExpressionItem cannot be resolved to a type
[ERROR] /opt/modules/bigtop/build/cloudbeaver/rpm/BUILD/dbeaver/plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/SQLSelectItem.java:[44]
[ERROR] final Expression itemExpression = ((SelectExpressionItem) item).getExpression();
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] SelectExpressionItem cannot be resolved to a type
[ERROR] /opt/modules/bigtop/build/cloudbeaver/rpm/BUILD/dbeaver/plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/SQLSelectItem.java:[44]
[ERROR] final Expression itemExpression = ((SelectExpressionItem) item).getExpression();
[ERROR] ^^^^^^^^^^^^^^^^^^^^
[ERROR] SelectExpressionItem cannot be resolved to a type
[ERROR] /opt/modules/bigtop/build/cloudbeaver/rpm/BUILD/dbeaver/plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/SQLSelectItem.java:[51]
[ERROR] final Alias alias = ((SelectExpressionItem) item).getAlias();
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] SelectExpressionItem cannot be resolved to a type
[ERROR] /opt/modules/bigtop/build/cloudbeaver/rpm/BUILD/dbeaver/plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/SQLSelectItem.java:[51]
[ERROR] final Alias alias = ((SelectExpressionItem) item).getAlias();
[ERROR] ^^^^^^^^^^^^^^^^^^^^
[ERROR] SelectExpressionItem cannot be resolved to a type
[ERROR] /opt/modules/bigtop/build/cloudbeaver/rpm/BUILD/dbeaver/plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/SQLSelectItem.java:[58]
[ERROR] } else if (item instanceof AllColumns) {
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] Incompatible conditional operand types SelectItem and AllColumns
[ERROR] /opt/modules/bigtop/build/cloudbeaver/rpm/BUILD/dbeaver/plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/SQLSelectItem.java:[61]
[ERROR] } else if (item instanceof AllTableColumns) {
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] Incompatible conditional operand types SelectItem and AllTableColumns
[ERROR] /opt/modules/bigtop/build/cloudbeaver/rpm/BUILD/dbeaver/plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/SQLSelectItem.java:[62]
[ERROR] table = ((AllTableColumns) item).getTable();
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] Cannot cast from SelectItem to AllTableColumns
[ERROR] /opt/modules/bigtop/build/cloudbeaver/rpm/BUILD/dbeaver/plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/parser/CustomExpression.java:[27]
[ERROR] public class CustomExpression implements Expression {
[ERROR] ^^^^^^^^^^^^^^^^
[ERROR] The type CustomExpression must implement the inherited abstract method Expression.accept(ExpressionVisitor<T>, S)
[ERROR] /opt/modules/bigtop/build/cloudbeaver/rpm/BUILD/dbeaver/plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/parser/SQLSemanticProcessor.java:[392]
[ERROR] SelectBody selectBody = select.getSelectBody();
[ERROR] ^^^^^^^^^^
[ERROR] SelectBody cannot be resolved to a type
[ERROR] /opt/modules/bigtop/build/cloudbeaver/rpm/BUILD/dbeaver/plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/parser/SQLSemanticProcessor.java:[428]
[ERROR] select.setWhere(new AndExpression(new Parenthesis(sourceWhere), conditionExpr));
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] The constructor Parenthesis(Expression) is undefined
[ERROR] 35 problems (35 errors)
[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
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :org.jkiss.dbeaver.model
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
编译小贴士
一般此类报错同时伴随多条 cannot be resolved to a type、is undefined for the type 相关提示,强烈建议完整粘贴日志 便于溯源定位。
# 问题成因分析
这些报错主要集中在 Java 依赖类型和方法找不到,直接根源在于 部分依赖 jar 包过期/下架,p2 仓库无法正常拉取。
- 旧版本 CloudBeaver/DBeaver 代码往往依赖 p2 服务器在线下载 jar
- 近几年由于原作者迁移、p2 仓库失效,导致历史构建环境下,除非本地曾缓存过,否则无法再获取对应依赖
- 这些类型和方法本应由相关 jar 提供(如
SelectExpressionItem
、PlainSelect
等),但缺失时 IDE/Maven 均无法编译通过
注意
如果你的编译环境没有历史缓存或本地 jar,遇到类似错误,常规方法已无法修复。 建议优先考虑:
- 切换新版本代码/依赖
- 直接使用本站已适配版本环境,避免重复采坑
# 环境可联系作者提供
- 01
- bigtop-select 打包缺 compat 报错修复 deb07-16
- 02
- bigtop-select 打包缺 control 文件报错修复 deb07-16
- 03
- 首次编译-环境初始化 必装07-16