I work on a distributed system, and multiple daemons need access to the same Postgres database via jOOQ. Since each daemon is its own Java project, I am in the same boat as you basically.
The solution I've been using is to create a third Java project as a Java Library. If you're using Netbeans you can just include it as a subproject dependency and any changes to the library project can be recompiled into the individual application projects.
One thing of note, you'll need to specify the jOOQ library jars in all 3 projects. In Netbeans its easy to specify a project's library directory, and have multiple projects share these dependencies. Netbeans will copy the dependencies at deployment time.
Edit:
The steps are basically:
- create a master layout for system, IE:
/master-project/ /master-project/library /master-project/software /master-project/software/daemon1 /master-project/software/daemon2 /master-project/common /master-project/common/utility1 /master-project/common/utility2
- create third-party "library" bundles of
{jar,src,docs}
under/master-project/library.
- create "application" projects under
/master-project/software
, making sure to tell Netbeans to only use third-party libraries under/master-project/library
. - create "library" projects under
/master-project/common
, making sure to tell NB only to use third-party libraries under/master-project/library
. - create a "library" for jOOQ code to be shared, as in step 4.
Each project is responsible for its own compile script (including generating jOOQ code, if desirable), and correctly specifying its dependencies out of /master-project/library
, and /master-project/common
.