Maven apt-get-plugin的肌瘤 [英] Maven apt-get-plugin for mysema

查看:68
本文介绍了Maven apt-get-plugin的肌瘤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在pom.xml中添加了以下代码段,但是在eclipse中,执行部分出错了:

I have added following snippet in my pom.xml, but in eclipse the execution part is error saying:

Plugin execution not covered by lifecycle configuration: com.mysema.maven:maven-apt-plugin:1.0.3:process (execution: default, phase: generate-sources)

尽管当我从命令行运行mvn clean install时,它仍然可以正常工作.

Though when I am running mvn clean install from command line it is working properly then.

<build>
        <plugins>
            <plugin>
                <groupId>com.mysema.maven</groupId>
                <artifactId>maven-apt-plugin</artifactId>
                <version>1.0.3</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>process</goal>
                        </goals>
                        <phase>generate-sources</phase>
                        <configuration>
                            <outputDirectory>${project.basedir}/target/generated-sources/java</outputDirectory>
                            <processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
                            <processors>
                                <processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
                        </processors>
                        <showWarnings>true</showWarnings>
                    </configuration>
                </execution>
            </executions>
        </plugin>

从命令行运行后,它会生成查询dsl类(QClasses),但是从eclipse中不会生成它们.

After running from command line, its generating query dsl classes (QClasses), but from eclipse its not generating them.

此外,当我从eclipse运行我的应用程序时,它显示以下错误:

Also, when I am running my application from eclipse, it gives following error:

Caused by: java.lang.ClassNotFoundException: xxx.QClass

eclipse maven插件有问题吗?我该如何解决?

Is there some problem with eclipse maven plugin? How can I resolve this?

推荐答案

如果仅需要从JPA实体类生成Q类,则另一种可能的解决方案是对querydsl-apt使用分类器,例如:

Another possible solution, if you only need to generate Q classes from JPA entity classes, is to use the classifier for querydsl-apt like:

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

在这种情况下,您完全不需要手动apt-maven-plugin构建配置.

In that case you don't need manual apt-maven-plugin build configuration at all.

这篇关于Maven apt-get-plugin的肌瘤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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