New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QClasses are not generated in a multi-module Maven project #3599
Comments
Not sure if it helps but this is my non-Jakarta setup for Spring Boot 2.7 which works fine on many multi-module projects: <dependencies>
...
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId> <!-- version omitted because of the SB starter parent -->
</dependency>
...
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>${querydsl.version}</version> <!-- version required -->
<classifier>jpa</classifier>
</path>
<path>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>${javax-persistence.version}</version> <!-- version required -->
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build> |
Hmm - I have such a multi-module maven project with querydsl.
|
@SebastianDietrich The Maven Plugin is no longer necessary. I really don't understand why it works in a single-module project and not in my multi-module setup. |
@simasch out of curiosity, what is not required? The compiler plugin configuration? |
Now I'm super confused! @scordio Yes the compiler plugin config. @SebastianDietrich After cleaning and adding the querydsl plugin that shouldn't be required anymore based on other issues it starts working again. |
Just checked - when I remove that plugin, it no longer works on my side. |
AFAIK, you have somehow to plug the I personally prefer the former to avoid third-party plugins but it's definitely personal taste. |
@SebastianDietrich as I wrote I have a project where I don't need to use the plugin |
I've tried the |
@simasch @bwgjoseph I just tried a simplified multi-module setup with the compiler plugin in a fresh Spring Boot 3.1.4: scordio/spring-boot-querydsl-example@3d68f80 It seems to work fine: I also tried the dependency-only config in a single module app and indeed it works fine, I guess because of the default annotation processors discovery process mentioned in the Also, if I try the same in the multi-module example, it also works: scordio/spring-boot-querydsl-example@9c55cea Could it be that you have a maven compiler configuration in a parent module that specifies some annotation processors? According to the For example, I tried to add the MapStruct processor, and the QueryDSL classes are no longer generated: scordio/spring-boot-querydsl-example@fe54d1b |
Thank you very much @scordio I'll investigate further tomorrow. |
Thanks @scordio. I do have other annotation processor where one of them is mapstruct. I think I tried some ordering but it wouldn't work for querydsl hence I have to fallback to apt plugin. I'm not sure if it's apt plugin or intellij config, but intellij is not reliable in terms of regenerating the qclasses whenever I have changes. Hence, I have to run clean compile manually to get the updated qclass. One more common scenario is when I create new class where I expect the qclass to also get generated but it doesn't. |
@bwgjoseph what if you try to rely on the automated discovery only? It means having the artifacts with the annotation processors as dependencies (with the I've tried it in scordio/spring-boot-querydsl-example@a8911dd |
I have to test it out but then again, there's further complication as well because the project also uses Lombok. Which there need to have configuration done for Lombok to work with mapstruct in the compiler plugin. :( |
@simasch what do you mean by multi-maven project? To use it via dependency management or just in module? Because it seems working in my case -> see https://github.com/arnosthavelka/spring-advanced-training/blob/develop/sat-jpa/pom.xml. I also tried usage via dependency management (see https://github.com/arnosthavelka/spring-advanced-training/tree/querydsl-dependency-management-uasage) and it seems working as well. I guess you just need always specify the classifier. |
facing the exact same issue. I first discribed it in the spring data mongo repository before being redirected here: spring-projects/spring-data-mongodb#4549. My setup is using Kotlin and Gradle though |
I use Spring Boot 3.1.4 and I've configured the dependencies in each module where QueryDSL is used
But no QClasses are generated.
If I use the exact same dependencies in a single module Spring Boot project everything works fine.
Any idea what the difference could be?
The text was updated successfully, but these errors were encountered: