Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse cannot find class com.google.common.reflect.TypeToken?

My project which uses Dataflow compiles just fine using

mvn compile

However when I import my project into eclipse, eclipse is unable to build the project and gives the following error

The project was not built since its build path is incomplete. 
Cannot find the class file for com.google.common.reflect.TypeToken. 
Fix the build path then try building this project
like image 831
Jeremy Avatar asked Apr 30 '26 11:04

Jeremy


1 Answers

Adding an explicit dependency on Guava to my pom file appears to have fixed the problem.

<dependency>
  <groupId>com.google.guava</groupId>
  <artifactId>guava</artifactId>
  <version>[18.0,)</version>
</dependency>

By running

mvn dependency:tree -Dverbose -Dincludes=com.google.guava

I learned that I had several dependencies that were pulling in Guava so by adding an explicit dependency I was able to force maven to pull in a newer version.

However, I don't know why running 'mvn compile' on the command line worked.

like image 140
Jeremy Avatar answered May 02 '26 19:05

Jeremy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!