Factor out some shared Java project bits.