[SOLVED] Semi-Complicated Source Setup in SDK to Organizse Server and Client Code Seperatley

Hello, I am currently creating a game which has a client, server, and common package. Each of these packages has several subpackages. How would I configure the JME3 SDK do do the equivalent to the following IntelliJ IDEA setup:
(sorry for the formatting, code tags were the only way I could think of preserve the indentation. Additionally, every module can access the entire JME3 library)

  Server Module:
    Contains server code
    Exports to GameName-Server.jar
    Exported jar includes compiled common module, all JME3 libraries, and project assets
    Can't access code in client module
  Common Module:
    Contains code used by both the server and client (ie. the message classes for SpiderMonkey)
    Does not export itself, but is instead included as a library in another jar
    Can only access it's own code
  Client Module:
    Contains client code
    Exports to GameName-Client.jar
    Exported jar includes compiled common module, all JME3 libraries, and project assets
    Can't access code in server module, can access code in common module

I would just do this in IntelliJ IDEA, but I’d much rather be able to also use the tools available only through the SDK (ie. terramonkey, j3o binaries, etc.). So, if there is some way that I can have all features of the SDK but still organize my code in an IntelliJ IDEA project that would work if there is no way to configure the SDK/NetBeans to do this.

I tried creating three SDK projects (one for each module), however it appears to be impossible to have them depend on each other, include the common module in their final jars – not as an external jar, bundle JME3 in the jar – again, not externally, and get netbeans to directly read off of the source of other projects rather than their latest built jar (ie. the server and client modules/projects would compile against the latest common JAR rather than the latest common source code, which I want compiled automatically whenever I compile either server or client modules/projects). Of course, I could just put everything in a single project, but then the only possible way (that I can figure out) to determine which runs (the server or client) is with a startup option, and I don’t want the server available to the people running the client (they should only have the compiled client and common modules) since this is, more or less, an MMO.

Thanks in advance to anyone who knows what I should do. I know this seems like spoonfeeding, but it really isn’t since I made a significant attempt (see previous paragraph) to solve this myself.

I use multiple projects and have them depend on each other all the time. Not sure which part of that is giving you grief. Even refactoring works across all of the projects.

When you add a dependency just “Add project…”

Based on what the interface said (which project jar to include was pointing to the compiled jar), it looks like I need to build project a before the changes I made in project a are available in project b. If this isn’t the case, then that is great however it does appear to be the case based on what l little information I could find. Additionally, when I build a project, my assets aren’t in the JAR and there is a libs folder – I want everything extracted into a two jar files – one for the client and one for the server. I can start I guess with a multi-project setup and see how that goes.

Have one project called Common.
Have one project called Server.
Have one project called Client.
Only Client has assets.

For Server, right click on the Libraries folder in the project tree.
Select “Add project…”

Select Common.

Common will now be built when you build your server. Common.jar will now be included with your server jars when you build your server.

Do the same for the Client project.

I have about 30 projects open right now and they all depend on various other projects… who in turn depend on others and so on. The builds take longer and Netbeans is not particularly great about it but it does work.

Ok, sounds good. I have one question though: I need my assets in the server as well for physics simulation (ie. I need to load the terrain to bounce bricks off of) since the server will be authoritative in that manner.

In that case, you will also have to refer to your common assets jar directly… and give it another name other than ‘assets.jar’. You can set this in the project settings for your common project. (asset jar name).

…then just add a jar dependency in the other projects. Since they already depend on that project as a project… the jar should get built before it is needed.

Ok, I’ll do that. Am I correct in assuming that as long as all three projects are in a single parent directory tracked by git, that it won’t be an issue if I use the same arrangement on different computers with different paths to the root directory tracked by git?

Now, on that I’m not sure. I don’t know if it keeps relative paths for the stuff that is nearby or not.

Ok, I guess I’ll find out when I transfer computers :P. The gui does show a relative path though, so I’m fairly optomistic. I’ll make sure to post back here with what happens :). Btw, thanks for all the help!