自定义QueryDSL输出的包

时间:2011-12-11 07:07:32

标签: java mongodb maven-3 querydsl

我使用Maven为MongoDB创建QueryDSL对象,这里是build xml,

<build>
        <sourceDirectory>src/main/java</sourceDirectory>
        <testSourceDirectory>src/test/java</testSourceDirectory>
        <plugins>                
            <plugin>
                <groupId>com.mysema.maven</groupId>
                <artifactId>maven-apt-plugin</artifactId>
                <version>1.0</version>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>process</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <outputDirectory>src/main/java</outputDirectory>
                    <!-- This processor uses the Spring MongoDB annotations for processing -->
                    <processor>org.springframework.data.mongodb.repository.support.MongoAnnotationProcessor</processor>                        
                </configuration>
            </plugin>
        </plugins>
    </build>

但它在与QDomain相同的包中为Domain生成查询类Domain

可以自定义插件以将Query类放在单独的包中吗?

1 个答案:

答案 0 :(得分:4)

您可以使用querydsl.packageSuffix APT选项为生成的包添加后缀。只需在配置

中添加以下块即可
<options>
    <querydsl.packageSuffix>.query</querydsl.packageSuffix>
</options>