I'm trying to integrate QueryDSL to my existing project with Spring Data, I've tried different samples and now I've decided to stick to this one Advanced Spring Data JPA - Specifications and Querydsl.
Problem: when I run the project as Maven generate-sources I get this error
error: Annotation processor 'com.mysema.query.apt.jpa.JPAAnnotationProcessor' not found
I'm adding this plugin to my pom.xml as the blog post indicates:
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>maven-apt-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources</outputDirectory>
<processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
</configuration>
</execution>
</executions>
</plugin>
and the dependency:
<dependency>
<groupId>com.mysema.querydsl</groupId>
<artifactId>querydsl-sql</artifactId>
<version>3.6.9</version>
</dependency>
Can anyone point me in the right direction on how to solve this or how to properly integrate QueryDSL to my project ? Thanks in advance!
The way I could make this work was using the com.querydsl.apt.jpa.JPAAnnotationProcessor instead of the com.mysema.query.apt.jpa.JPAAnnotationProcessor and by changing the dependencies as follow:
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>4.0.6</version>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
<version>4.0.6</version>
</dependency>
The plugin end up like this:
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.1.3</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
<processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
</configuration>
</execution>
</executions>
</plugin>
I also executed in the command line at the projects root mvn eclipse:eclipse to update Eclipse to include the generated sources.
Update:
Replaced the plugin maven-apt-plugin for apt-maven-plugin and changed version to 1.1.3