So I found the solution after looking around, a lot thanks to Timos partial solution.
Basically it's 2 parts.
- Generate the QueryDSL classes to another package
- Exclude that package from findbugs-maven-plugin (See http://blog.sinarf.org/2009/03/exclude-generated-classes-from-findbugs.html)
pom.xml:
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<configuration>
<failOnError>true</failOnError>
<excludeFilterFile>findbugs-exclude.xml</excludeFilterFile>
</configuration>
</plugin>
...
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>maven-apt-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources-jpa</outputDirectory>
<processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
<options>
<querydsl.packageSuffix>.generated</querydsl.packageSuffix>
</options>
</configuration>
</execution>
</executions>
</plugin>
...
findbugs-exclude.xml:
<FindBugsFilter>
<Match>
<Package name="com.example.transactions.generated" />
</Match>
</FindBugsFilter>