IntelliJ IDEA Plugin

Ebean uses bytecode enhancement to provide dirty checking and lazy loading. Install Ebean's IntelliJ plugin such that entity beans and transactional methods are enhanced when run develop and run tests in the IDE.

Install the Plugin

File > Settings > Plugins > "ebean"

Install Ebean IDEA Plugin

Turn plugin on per project

The plugin is turned on and off per project. We need to turn it on for it to perform enhancement on the current project.

Generated Sources

To confirm things are working properly we check that the target/generated-sources/annotations directory is marked as Generated Sources Root. If this directory isn't recognised by the IDE as a generated sources root then we won't be able to import and use query beans and the IDE will give compiler errors - unknown type for the query beans.

Generated Sources Root

Check that target/generated-sources/annotations directory is marked as Generated Sources Root

Manually mark Generated Sources Root

If IntelliJ has not automatically marked the directory as Generated Sources we can manually do so:

Click on target/generated-sources/annotations - Right Mouse - Mark Directory as - Generated Sources Root

Plugin javaagent

What this plugin does is adds ebean-agent.jar as a javaagent to the command line when IDEA runs tests or main methods for the project. In the IDEA console we can click on the the command line to expand it showing us the full command line used including the -javaagent command line option specifying the ebean agent.

Command line

The very first line of output in the IDEA console is by default truncated with .... Click on this first line expands to show the entire command line used.

Click on the command line

Clicking on the first line of the output expands to show the full command line used to run tests/main methods. In the command line we see the -jaavagent argument specifying the ebean agent used for enhancement.