【发布时间】:2013-11-22 19:25:16
【问题描述】:
使用 Maven 和 TestNG 进行本地设置,构建得很好。考虑到为了运行测试,构建有点奇怪,首先需要一个打包的 JAR。所以实际上本地设置运行
#!/bin/bash
mvn clean package -Dmaven.test.skip.exec=true
mvn test
在 Jenkins 上运行时,clean/package 步骤和测试一样成功,但实际上没有运行测试:
[workspace] $ mvn -f some_sub_directory/pom.xml test
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ...-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ project ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /var/lib/jenkins/jobs/...
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ project ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ project ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ project ---
[INFO] Not compiling test sources
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ project ---
[INFO] Tests are skipped.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.222s
[INFO] Finished at: Fri Nov 22 18:34:00 UTC 2013
[INFO] Final Memory: 11M/89M
[INFO] ------------------------------------------------------------------------
Finished: SUCCESS
似乎surefire插件中的testCompile和test目标没有找到任何测试类。
在 pom.xml 中是否需要额外的配置?
【问题讨论】: