1

I would like to update my version of Querydsl. I was looking for generating Q-Classes with the apt-maven-plugin like this:

<plugin>
    <groupId>com.mysema.maven</groupId>
    <artifactId>apt-maven-plugin</artifactId>
    <version>1.1.3</version>
    <executions>
        <execution>
             <goals>
                  <goal>process</goal>
              </goals>
              <configuration>
                  <outputDirectory>target/generated-sources/java</outputDirectory>
                  <processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
              </configuration>
          </execution>
     </executions>
</plugin>

Some versions I 'm using:

<spring.security.version>4.2.0.RELEASE</spring.security.version>
<spring.context.version>4.3.4.RELEASE</spring.context.version>
<springdata.jpa.version>2.0.0.M1</springdata.jpa.version>
<springdata.es.version>2.0.5.RELEASE</springdata.es.version>
<springdata.common.version>2.0.0.M1</springdata.common.version>
<querydsl.version>4.1.4</querydsl.version>

But unfortunalty this generates me nothing on the generated-sources folder as expected. So can you give me some ways to understand what has failed in my Querydsl configuration please?

Thanks per advance.

christophedebatz
  • 184
  • 3
  • 16
  • I am facing the same issue. My entities are stored in jar dependency. What about yours? Used to work with 4.0.7 – banterCZ Sep 22 '17 at 08:35

1 Answers1

3

Make sure that the querydsl-apt library is available on the build classpath.

Option 1: Add the library as a dependency to the APT plugin

<plugin>
  <groupId>com.mysema.maven</groupId>
  <artifactId>apt-maven-plugin</artifactId>
  <version>1.1.3</version>
  <dependencies>
    <dependency>
      <groupId>com.querydsl</groupId>
      <artifactId>querydsl-apt</artifactId>
      <version>${querydsl.version}</version>
    </dependency>
  </dependencies>
  <executions>
    <execution>
      <goals>
        <goal>process</goal>
      </goals>
      <configuration>
        <outputDirectory>target/generated-sources/java</outputDirectory>
        <processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
      </configuration>
    </execution>
  </executions>
</plugin>

Option 2: Add the library as a project dependency

<project>
  ..
  <dependencies>
    <dependency>
      <groupId>com.querydsl</groupId>
      <artifactId>querydsl-apt</artifactId>
      <version>${querydsl.version}</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>
</project>

Note <scope>provided</scope> in this case, which will ensure that the library does not get bundled with the application.

manish
  • 19,695
  • 5
  • 67
  • 91
  • Hi thanks for your help but I had also tried this solution and it didn't work for me. Any other significant idea guys? Thanks per advance. – christophedebatz Jan 06 '17 at 21:14
  • Can you post your problematic project somewhere? Sample classes will do. I have a sample on [Github](https://github.com/manish-in-java/stackoverflow-questions/tree/master/41386005) in case you would like to take a look and compare it with your project. – manish Jan 07 '17 at 09:24