IntelliJ IDEA

Using QueryDSL annotation processor with Gradle and IntelliJ IDEA

Posted on by  
Tom de Vroomen

Making IntelliJ understand your QueryDSL generated classes needs some work. QueryDSL has an annotation processor to generate Q-classes from your entities. Just running the annotation processor doesn’t mean your IDE will understand where to find the generated classes. I was struggling to get IntelliJ IDEA picking up the generated classes. Probably there are more ways to get this done in Gradle, but I found out one that’s pretty easy to configure, without any adjustments to you IntelliJ settings. Because you could configure the annotation processor via the IntelliJ settings in the Annotation Processor screen (Build, Execution, Deployment → Compiler → Annotation Processors). It would be easier if you can achieve the same just using Gradle. With the following in your Gradle build file, it generates the classes and instructs IntelliJ where to find the classes:

If you’re using Lombok in your entities, generating the QueryDSL classes will fail, as it won’t understand the Lombok annotations. To solve this you have to add the Lombok dependency to the annotationProcessor block.

Continue reading →

Gradle Goodness: Quickly Open Test Report in IntelliJ IDEA

Posted on by  
Hubert Klein Ikkink

When we execute a Gradle test task in IntelliJ IDEA the IDE test runner is used. This means we can get a nice overview of all tests that have run. If a test is successful we get a green light, otherwise it is red in case of an error or orange in case of a failure. Gradle also generates a nice HTML report when we run the test task. It is placed in the directory build/reports/tests/. IntelliJ IDEA has a button which opens this report when we click on it. The following screenshot shows the button with the tooltip that opens a Gradle test report:

Continue reading →

shadow-left