我已按照本文档http://www.querydsl.com/static/querydsl/2.1.0/reference/html/ch02s02.html中所述的说明进行操作
之后,在我的Eclipse中,我出现了以下错误:
Plugin execution not covered by lifecycle configuration: com.mysema.maven:maven-apt-plugin:1.0:process (execution: default, phase: generate-sources) pom.xml /projectname line 266 Maven Project Build Lifecycle Mapping Problem
另外,按照QueryDSL文档中的建议,我已经执行了
mvn eclipse:eclipse
为了包括
target/generated-sources/java
作为源文件夹,现在我有很多警告:所以我的问题是:
通过在我的pom.xml中添加以下内容来解决
Plugin execution
错误的正确方法是:<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
com.mysema.maven
</groupId>
<artifactId>
maven-apt-plugin
</artifactId>
<versionRange>
[1.0,)
</versionRange>
<goals>
<goal>process</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
有没有一种更好的方法可以将
target/generated-sources/java
作为源文件夹而不执行mvn eclipse:eclipse
? 最佳答案
生成源的正确目标是:mvn generate-sources
这将在编译之前创建QueryDSL查询。
另外,您正在寻找的文档是QueryDSL 2.x版本的。
检查最新版本! http://www.querydsl.com/static/querydsl/4.0.7/reference/html_single/