QueryDsl - How to create Q classes with maven?

好久不见. 提交于 2019-12-19 07:47:12

问题


I have web project spring mvc with spring data
here is example :
https://github.com/prilia/SpringJpa-Quarydsl-Test/tree/master/JpaSpringQuarydsl

I checked a lot of pom.xml that I found in web to create a Q classes of entities, but no lack.
Please help me with creating Q classes with maven.

Hi, Thanks to Timo, I found my real problem -> QueryDsl and @JsonAutoDetect - Q classes not generated


回答1:


you need plugin, try this:

                <plugin>
                    <groupId>com.mysema.maven</groupId>
                    <artifactId>maven-apt-plugin</artifactId>
                    <version>1.0.4</version>
                    <executions>
                        <execution>
                            <id>process-common-model</id>
                            <goals>
                                <goal>process</goal>
                            </goals>
                            <phase>generate-sources</phase>
                            <configuration>
                                <sourceDirectory>${project.build.directory}/{yourSourceDir}</sourceDirectory>
                            </configuration>
                        </execution>
                    </executions>
                    <configuration>
                        <outputDirectory>target/generated-sources/querydsl</outputDirectory>
                        <processors>
                            <processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
                        </processors>
                        <options>
                            <querydsl.entityAccessors>true</querydsl.entityAccessors>
                            <querydsl.createDefaultVariable>true</querydsl.createDefaultVariable>
                            <querydsl.packageSuffix>.qdsl</querydsl.packageSuffix>
                        </options>
                    </configuration>
                </plugin>

I copied this from my project. just added it to your pom and have a try.

There are additional options in the code above, if you just wanna a simple one, focus on the querydsl reference



来源:https://stackoverflow.com/questions/24889990/querydsl-how-to-create-q-classes-with-maven

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!