SBT/JPA not generating the @entity classes
One of my previous co-workers set up this project which is using play framework, SBT, and JPA. Everything was working fine. When I "run" my project in intellij it would read the @entity classes and build the appropriate "class_" files. Our persistence.xml file is set to "validate" so it would verify that the DB and the entities were in sync. Currently running intellij 2017.2.6
Then yesterday I tried installing 2017.3 and everything blew up. I don't think 2017.3 recognized SBT correctly because the icons were not anything close to the same. I uninstalled 2017.3 but now my project is messed up somehow. I can't for the life of me figure out how to get SBT to put the classes in the "generated" folder; i.e. the "class_" files. So it's impossible for me to run the project now.
I can't seem to figure out what setting or whatever has gotten changed/corrupted despite hours of searching on the internet. I've tried invalidate caches and restart and also tried uninstalling the scala plugin from intellij and re-installing it. Any hint on how to resolve this would be greatly appreciated. At this point I don't even know what kind of relevant information I might be leaving out of this post so if there is information needed please let me know.
Please sign in to leave a comment.
Try to delete .idea directory and reimport the project from SBT.
Forgive me if this is a stupid question but I'm pretty new to Intellij. Should I delete the directory from within intellij or is it better to close it and delete from the file system?
Close the project and delete it from the file system.
ok tried that and I got this error message which is super unhelpful.
I manually checked the "SBT Sources" box and the "Use SBT shell . . ." box. Unchecking those is letting me hit the "OK" button at least.
Well that was cool. Now none of my annotations are registering so they are all highlighted red. Clearly I don't know how to do this properly.
Adding "JPA" and "WebServices Client" to my project resolved the annotations issue. Now I'm back to getting the same issue as before though. When I try to start the project I get a whole bunch of missing class errors and nothing is ending up in my "generated" folder.
Feel free to report at https://youtrack.jetbrains.com/issues/SCL and provide a small sample project to reproduce it.
Ok so I completely deleted the projects from my local drive. installed 2017.3 and imported the project from our git server. That seems to have fixed the issue with not populating the "generated" folder. So yay for that. But now I'm getting errors when I try to run the project which I'm guessing have to do with some plugin or something not being assigned to the project that needs to be. Sample errors below:
play.api.UnexpectedException: Unexpected exception[ProvisionException: Unable to provision, see the following errors:
1) No implementation for java.util.Map<java.lang.String, services.CrudService<?>> was bound.
while locating java.util.Map<java.lang.String, services.CrudService<?>>
3) Could not find a suitable constructor in java.lang.Class. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.
at java.lang.Class.class(Class.java:119)
Does your project build/run without errors from the command line SBT build?
It turns out the error that time was me not having created my local settings file again. It's configured in my environment variables but it's a computer specific file so it's not checked into the project. Once I created that file I'm getting exciting new errors. Can't connect to the database for some reason. Hopefully this one is easier for me to figure out.
I typo'd the password. All working again. Still no idea what the problem was but deleting all local files and re-importing the project from source control seems to have resolved it.