gpt4 book ai didi

maven-plugin - apt maven 插件无法生成 Q 类

转载 作者:行者123 更新时间:2023-12-01 02:26:38 27 4
gpt4 key购买 nike

我正在修复一个使用 Querydsl apt 的遗留项目。出于某种原因,apt-maven-plugin开始失败。我发现的唯一解决方法是使用另一个自我 maven-processor-plugin .

我重新安装了 maven、eclipse 和 M2E,但没有太大成功。 maven-apt-plugin 无法在/target/generated-sources/metamodel 下创建 Q 类。

编辑:从 Maven 添加调试

[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
n.misc.Launcher$AppClassLoader@6d9bf996]
[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
ontext@27bb2f11
[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 的一些细节 - Eclipse 的 Maven 集成 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)
Java HotSpot(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 插件的新 POM
<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>

最佳答案

您的项目是否在命令行中构建?

如果没有,它很可能也无法在 Eclipse 中构建。

现在,如果 CLI 确实有效,您是否尝试过安装 m2e-apt?它将使注释处理成为 Eclipse 增量构建过程的一部分。见 https://github.com/jbosstools/m2e-apt/更多细节。

关于maven-plugin - apt maven 插件无法生成 Q 类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15833988/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com