我们公司拥有自己的Maven资源库,我们从那里下载Maven依赖项。当我在命令行上运行maven clean test时,它不会从Java文件生成目标类和测试类。
问题:
运行mvn clean测试时,目标>测试类没有生成的.class文件。
4.0.0 Automation-Framework Automation-Framework 1.0.0-SNAPSHOT
<maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.source>1.8</maven.compiler.source>
org.apache.maven.plugins maven-surefire-plugin 3.0.0-M3 ChromeTestManager.java
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
命令行输出:
[INFO] Scanning for projects [INFO] Deleting target folder
[INFO] --- maven-clean-plugin:2.6:resources (Default resources) @ Automation Framework
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent
[INFO] --- maven-compiler-plugin:3.1:compile
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent [INFO] --- maven-resources-plugin:2.6:testResources [INFO] Copying 0 resource [INFO] --- maven-compiler-plugin:3.1testCompile [INFO] Nothing to compile - all classess up to date [INFO] --- maven-surefire-plugin:3.0.0.-M3:test (default-test) @ Automation-Framework [Info] Build Success
可以在命令行输出中看到粘贴的内容
[INFO] --- maven-resources-plugin:2.6:testResources [INFO] Copying 0 resource [INFO] --- maven-compiler-plugin:3.1testCompile [INFO] Nothing to compile - all classess up to date
在构建配置中缺少maven-resources-plugin 。
将以下内容添加到你的
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
资源文件从复制src/main/resources到target/classes。
编辑:这没有帮助。资源复制为0。目标-类会生成,但不是目标-测试类。
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。