Solution:

when missing packages in Java class, hovering over the package name when it’s showing Add Maven Dependencies, click it. Do not manually write dependencies in pom.xml

e.g.

1
thrift --gen java --out ../message-thrift-java-service-api/src/main/java message.thrift

Using thrift file to automatically generate Java class, but many packages is missing. Click on “Add Maven Dependencies”