我正在修復使用Querydsl apt的遺留項目。由於某種原因,apt-maven-plugin開始失敗。我發現的唯一解決方法是使用alter ego maven-processor-plugin。apt Maven插件無法生成Q類
我重新安裝了maven,eclipse和M2E,並沒有取得太大的成功。 maven-apt-plugin無法在/ target/generated-sources/metamodel下創建Q類。
編輯:從行家加入調試
[DEBUG] Configuring mojo com.mysema.maven:apt-maven-plugin:1.0.8:process from pl
ugin realm ClassRealm[plugin>com.mysema.maven:apt-maven-plugin:1.0.8, parent: su
[email protected]]
[DEBUG] Configuring mojo 'com.mysema.maven:apt-maven-plugin:1.0.8:process' with
basic configurator -->
[DEBUG] (s) logOnlyOnError = true
[DEBUG] (s) outputDirectory = C:\DEV\myproject\mainstuff\mainstuff-jpa\target\generate
d-sources\metamodel
[DEBUG] (s) pluginArtifacts = [com.mysema.maven:apt-maven-plugin:maven-plugin:
1.0.8:, org.sonatype.plexus:plexus-build-api:jar:0.0.7:compile, org.codehaus.ple
xus:plexus-utils:jar:1.5.8:compile, backport-util-concurrent:backport-util-concu
rrent:jar:3.1:compile, org.codehaus.plexus:plexus-interpolation:jar:1.11:compile
, junit:junit:jar:3.8.1:compile]
[DEBUG] (s) processor = com.mysema.query.apt.jpa.JPAAnnotationProcessor
[DEBUG] (s) project = MavenProject: com.yreham.mainstuff:mainstuff-jpa:1.0
@ C:\DEV\myproject\mainstuff\mainstuff-jpa\pom.xml
[DEBUG] (s) sourceEncoding = ISO-8859-1
[DEBUG] -- end configuration --
[DEBUG] Using build context: org.sonatype.plexus.build.incremental.DefaultBuildC
[email protected]
[ERROR] C:\DEV\myproject\mainstuff\mainstuff-jpa\src\main\java\com\yreham\mainstuff\j
pa\queries\InstancesQuery.java:40: error: cannot find symbol
import com.yreham.mainstuff.jpa.entity.QCIEntity;
的配置M2E的一些細節 - Maven的集成爲Eclipse 1.2.0.20120903-1050 org.eclipse.m2e.feature.feature.group Eclipse.org - M2E
Java版本 「1.7.0_15」 的Java(TM)SE運行時環境(建立1.7.0_15-B03) 爪哇熱點(TM)64位服務器VM(構建23.7-B01,混合模式)
(目標版本是Java 1.6)
這裏的老POM XML
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.0.8</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>${apt.target.dir}</outputDirectory>
processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
<logOnlyOnError>true</logOnlyOnError>
</configuration>
</execution>
</executions>
</plugin>
與BSC插件
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<version>2.0.5</version>
<executions>
<execution>
<id>process</id>
<goals>
<goal>process</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<outputDirectory>${apt.target.dir}</outputDirectory>
<processors>
<processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
</processors>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>1.2.0.Final</version>
</dependency>
</dependencies>
</plugin>
您是否遇到apt-maven-plugin使用的異常? – 2013-04-06 11:12:36
根據下面的resquest我更新與調試輸出的問題。該插件不會拋出異常,它只會找不到Q *類 – 2013-04-08 12:01:54
您使用哪個Querydsl版本?你也使用Spring Data嗎?如果是,哪個版本? – 2013-04-08 14:01:11