gpt4 book ai didi

Maven无法编译测试类

转载 作者:行者123 更新时间:2023-12-02 04:51:38 25 4
gpt4 key购买 nike

我想编译来自不同目录的源代码。

        <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<includes>
<include>src/main/java/**/*.java</include>
<include>generated-sources</include>
</includes>
<source>1.6</source>
</configuration>
</plugin>

每次尝试构建时,我都会在测试类上遇到错误:

[INFO] [compiler:testCompile {execution: default-testCompile}]

[ERROR] /home/user/project/src/test/java/com/company/model/hub/ToplogyFileUtilsTest.java:[8,45] error: package com.company.model.logic.hub does not exist

[ERROR] /home/user/project/src/test/java/com/company/model/entity/cfg/dto/OidDTOTest.java:[11,43] error: package com.company.model.dto.cfg does not exist

[ERROR] /home/user/project/src/test/java/com/company/model/fault/EventTest.java:[12,48] error: package com.company.model.entity.fault does not exist
...

最佳答案

您错过了添加测试类的源代码。将其添加到包含

<include>src/test/java/**/*.java</include>

关于Maven无法编译测试类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27545020/

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