Upgrade to springboot 2.6.1 with querydsl jpa 5.0.0

I am trying to upgrade my springboot version from 2.3.4 to 2.6.1. I use query dsl with jpa and apt-maven-plugin. My issue is that I can't no more generate the QClasses when I run maven compile. I noticed that I am no more able to use an older version of querydsl (previous one 4.4.0 and apt-maven-plugin 1.1.3). Now when I try to use the 4.4.0 I have an error :

Non-resolvable import POM: com.querydsl:querydsl-bom:pom:4.4.0 was not found in

And then when I switch to the 5.0.0 version I have an other error :

[INFO] --- apt-maven-plugin:1.1.3:process (default) @ gof-referentiel-backend --- [WARNING] The artifact org.apache.commons:commons-io:jar:1.3.2 has been relocated to commons-io:commons-io:jar:1.3.2: /home/ezek/Documents/projects/gof-referentiel-backend/src/main/java/fr/ubordeaux/gof/referentiel/common/persistence/dao/impl/ContactDAOImpl.java:12: error: cannot find symbol import fr.ubordeaux.gof.referentiel.common.persistence.entity.QContactEntity; ^ symbol: class QContactEntity location: package fr.ubordeaux.gof.referentiel.common.persistence.entity /home/ezek/Documents/projects/gof-referentiel-backend/src/main/java/fr/ubordeaux/gof/referentiel/common/persistence/dao/impl/ContactDAOImpl.java:29: error: cannot find symbol private static final QContactEntity qContactEntity = QContactEntity.contactEntity;

I get this error for all the classes that use entities. And nothing is generated.

Here is are the relevant values of my pom.xml :

> <dependency> > <groupId>com.querydsl</groupId> > <artifactId>querydsl-apt</artifactId> > <version>${querydsl.version}</version> > </dependency> > <dependency> > <groupId>com.querydsl</groupId> > <artifactId>querydsl-jpa</artifactId> > <version>${querydsl.version}</version> > </dependency> > > <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>target/generated-sources/java</outputDirectory> > > <processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor> > </configuration> > </execution> > </executions> ></plugin> 

I also use mapstruct and lombok if maybe it is related (but I don't think) because the apt-maven-plugin runs before them.

7

1 Answer

It appears you're still (perhaps transitively) relying on some Querydsl 4.0.0 dependencies. You need to remove those (I can't point out which ones, because you didn't include the full POM in your snippet).

I also recommend getting rid of the plugin altogether and instead using the dependency classifier:

 <dependency> <groupId>com.querydsl</groupId> <artifactId>querydsl-apt</artifactId> <version>${querydsl.version}</version> <classifier>jpa</classifier> <scope>provided</scope> </dependency> <dependency> <groupId>com.querydsl</groupId> <artifactId>querydsl-jpa</artifactId> <version>${querydsl.version}</version> </dependency> 
5

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like