QueryDsl-如何使用Maven创建Q类? [英] QueryDsl - How to create Q classes with maven?

查看:280
本文介绍了QueryDsl-如何使用Maven创建Q类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有带有Spring数据的Web项目spring mvc
这是示例:
https://github.com/prilia/SpringJpa-Quarydsl-Test/树/主文件/JpaSpringQuarydsl

我检查了很多在Web上找到的pom.xml,以创建Q类实体,但并不缺少.
请帮助我使用Maven创建Q类.

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.

感谢Timo,我发现了我的真正问题-> QueryDsl和@JsonAutoDetect-未生成Q类

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

推荐答案

您需要插件,请尝试以下操作:

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>

我从项目中复制了此内容.刚刚将其添加到您的pom中并尝试一下.

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

这篇关于QueryDsl-如何使用Maven创建Q类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆