I have made a Scala project in IntelliJ. It implements akka actors.
I would run it on a local server.
Then I plan to make a client project which would talk to actors project. I would be using some of the message classes from first project in client project.
How to structure it? How do I add this dependency in client project?
I would recommend you create a third module, called something-protocol, and move the message classes which will be sent between the client and the server into there.
Then, since you will have three separate modules, I would recommend you set up a build system such as Gradle or Maven or sbt if you haven't already, and add the dependencies between the three modules (i.e. client depends on protocol, server depends on protocol) in the build configuration files. That way, anyone who checks out your code from version control will be able to build your project, even if they choose not to use IntelliJ.
You can either:
use a multi-module build so that it all appears as one project in IntelliJ. This way you don't have to worry about versioning.
make them three completely separate modules, in which case you should version the modules and the dependency specifications in the build files, to try to avoid incompatibility problems. You should use semantic versioning for this. You will also have to ensure that you don't accidentally deploy incompatible versions of the client and the server - dependency version checks at build time are not enough in this scenario.
Which approach you choose will depend on your deployment requirements. If you need to be able to independently upgrade the client and the server, you will have to choose the second approach.