Play Framework Activator compile command has " does not exist" and "cannot find symbol" errors but Eclipse shows no errors

227 views Asked by At

I am using Activator to compile and run my Play Framework application. I am using Eclipse as my IDE.

When I use the compile command, I continually get "cannot find symbol" errors: enter image description here

I have imported all the .jar files into my project in the Build Path: enter image description here

The project in Eclipse compiles fine - there are no errors, no missing '.jar' files. I have no errors in the project: enter image description here

I have:

  • Restarted both Eclipse and activator
  • Compiled with eclipse with-source=true activator command
  • Removed target and project\target` folders and recompiled

EDIT: When I remove the .jar files from the Build Path and compile, I receive no errors in activator, but have errors in Eclipse. This makes no sense.

I have never run into this issue and cannot find a solution. Any help would be great.

2

There are 2 answers

0
Dan On

After an hour messing with this, I moved the .jar files from the lib\drive\libs folder to the lib folder and it compiled without errors in Eclipse and in Activator.

I have no idea why that fixed the issue, but it works now.

0
marcospereira On

Importing jars into Eclipse and Activator projects are not the same. Activator does not recognize the configurations you made in Eclipse. The recommended way to add these dependencies is to declare them in your build.sbt file, like this:

// https://mvnrepository.com/artifact/com.google.api-client/google-api-client
libraryDependencies += "com.google.api-client" % "google-api-client" % "1.22.0"

This is better explained in Play docs and also sbt docs (Activator is just a wrapper around sbt).

If you declare the required dependencies like described above, Eclipse will also recognize them when importing the project. Finally, it is possible that some jars aren't available in public repositories. Play calls these "unmanaged dependencies" and you need to add them to your lib folder.