You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Tycho-compiler-plugin无法识别测试类:多模块构建依赖问题求助

Eclipse插件模块Maven构建依赖与编译异常问题

项目结构与依赖逻辑

  • 项目包含model和parser两个eclipse-plugin打包模块,model在父pom中声明于parser之后
  • parser模块生成inez-parser-<version>-testing.jar测试工件,通过initialize阶段的maven-dependency-plugin:copy-dependencies将其复制到model/target/dependency/目录,首次构建时该文件已存在

首次构建编译错误

执行mvn install时,testCompile阶段抛出以下错误:

[ERROR] /home/mag/project/KodeKonveyor/inez-server/model/src/test/java/io/github/magwas/inez/BridiTestData.java:[10] 
[ERROR]     public interface BridiTestData extends BridiElementTestData {
[ERROR]                      ^^^^^^^^^^^^^
[ERROR] The hierarchy of the type BridiTestData is inconsistent

BridiTestData间接依赖inez-parser-testing.jar中的类

.classpath配置与后续异常

当前model/.classpath配置内容:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21"/>
    <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
    <classpathentry kind="src" path="src/main/java"/>
    <classpathentry exported="true" kind="lib" path="target/classes" sourcepath="target/classes"/>
    <classpathentry kind="output" path="target/classes"/>
  <classpathentry kind="lib" path="target/dependency/mockito-core.jar"/>
  <classpathentry kind="lib" path="target/dependency/junit-jupiter-api.jar"/>
  <classpathentry kind="lib" path="target/dependency/junit-jupiter-engine.jar"/>
  <classpathentry kind="lib" path="target/dependency/junit-platform-commons.jar"/>
  <classpathentry kind="lib" path="target/dependency/junit-platform-engine.jar"/>
  <classpathentry kind="lib" path="target/dependency/junit-platform-launcher.jar"/>
  <classpathentry kind="lib" path="target/dependency/konveyor-base-testing.jar"/>
  <classpathentry kind="lib" path="target/dependency/inez-parser-testing.jar"/>
  <classpathentry kind="lib" path="target/dependency/spring-test.jar"/>
</classpath>
  • 若移除<classpathentry kind="lib" path="target/dependency/inez-parser-testing.jar"/>,每次执行mvn install都会触发上述层级不一致错误
  • 添加该行后,第二次构建出现新错误:
[ERROR] /home/mag/project/KodeKonveyor/inez-server/model/src/test/java/io/github/magwas/inez/element/BridiElementEndToEndTest.java:[20] 
[ERROR]     import io.github.magwas.inez.TestConfig;

实际TestConfig类已完成编译,可在以下路径找到对应文件:

$ find |grep TestConfig
./model/src/test/java/io/github/magwas/inez/TestConfig.java
./model/target/test-classes/io/github/magwas/inez/TestConfig.class

特殊现象与环境信息

  • 执行mvn clean后,单独进入model目录执行mvn install可成功编译(但测试未运行)
  • 当前构建环境:Maven 3.9.11 + Tycho 4.0.12(因需升级Tycho以正确解析目标平台);此前使用Maven 3.8.7 + Tycho 3.0.5版本时,可正常完成全量构建与测试

求助需求

可提供model/build.properties与model/META-INF/MANIFEST.MF配置文件,需解决如何让model模块在完整项目首次构建时顺利完成编译与测试流程。

内容的提问来源于stack exchange,提问作者Árpád Magosányi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.12 12:12:28