Configure the background compilation
Press ⌘ Comma to open the IDE settings and select Build, Execution, Deployment | Compiler.
On the Compiler page, select Build project automatically.
Now when you make changes in the class files, IntelliJ IDEA automatically performs the incremental build of the project.
The automatic build also gets triggered when you save the file (⌘ S) or when you have the Save files automatically if application is idle for N sec. option selected in the System settings dialog.
To use the module you simply need to add it as a dependency in your
Maven POM:
or your Gradle build file: