1. Make an ant/maven/gradle repo, and have the build command run gradle build or something.
2. Create a commandline (open source) tool called "intellibuild" or something, which reads the project files and does whatever the "build" button does.
Unfortunately, they don't do either, so if I don't have a license (or I want to give my code to others who don't use IntelliJ), my J2EE is not buildable.