[英]Maven not running tests through eclipse in multimodule project
我有一個簡單的多模塊Maven項目結構,如下所示:
main-project :
-test-child-one :
-test-child-three :
-test-child-two :
當我從父項目內部通過Eclipse運行mvn test
,沒有運行測試。
我也嘗試從子項目之一test-child-one
內部運行mvn test
,但是測試未運行。
它總是顯示-
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
父母和孩子的pom如下:
父pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.atul.multimodule</groupId>
<artifactId>main-project</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>main-project</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<modules>
<module>test-child-one</module>
<module>test-child-two</module>
<module>test-child-three</module>
</modules>
</project>
兒童pom:
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.atul.multimodule</groupId>
<artifactId>main-project</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>com.atul.multimodule</groupId>
<artifactId>test-child-one</artifactId>
<version>1.0-SNAPSHOT</version>
<name>test-child-one</name>
<url>http://maven.apache.org</url>
</project>
我在這里想念什么嗎?
請幫忙。
約定范式的約定與Maven有關,這很重要,這意味着您具有默認的目錄布局,當然還有命名模式。 這意味着您必須根據這些模式來命名測試。
要定義單元測試,您應該這樣命名它們:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.