编辑:我现在已经将项目分成了它的组成部分,事实证明 QueryDSL 和 JaxWS 都是无辜的。问题存在于项目的其他地方。来自 QueryDSL 的错误消息是一个表面问题,但不要破坏构建。
我的项目使用来自 QueryDSL(JPA 查询)和 JaxWS(来自 WSDL 的 Web 服务客户端代码生成)的代码生成。
运行 Maven 构建时,QueryDSL 代码生成阶段会产生大量错误,因为它会尝试处理引用生成的 Web 服务客户端的服务类。例如:
[INFO] --- jaxws-maven-plugin:1.12:wsimport (default) @ Project---
[INFO]
[INFO] --- maven-apt-plugin:1.0:process (default) @ Project---
/home/adrian/test/Project/src/main/java/uk/co/humboldt/Project/Service/Inspect/Inspect.java:25: package org.supplier.webservice.contractservice does not exist
import org.supplier.webservice.contractservice.ArrayOfString;
我试图从 QueryDSL 处理中排除服务类:
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>maven-apt-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources/java</outputDirectory>
<processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
<options>
<querydsl.excludedPackages>uk.co.humboldt.Project.Service</querydsl.excludedPackages>
</options>
</configuration>
</execution>
</executions>
</plugin>
我的构建最终失败了
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ Project---
[INFO] Compiling 590 source files to /home/adrian/test/Project/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] Failure executing javac, but could not parse the error:
55 errors
我尝试使用build-helper
like this answer添加源文件,但它没有改变任何东西。有什么建议么?我怀疑将我的域对象和查询类拆分为单独的 JAR 将解决问题,但我更乐意在单个 POM 中修复它。