簡體   English   中英

為什么Maven surefire甚至沒有運行?

[英]Why is maven surefire not even running?

我一直在嘗試拆分存儲庫以運行特定的測試,由於surefire的原因,我在運行測試時遇到了一些問題。

當試圖通過甚至簡單地調用mvn test來運行任何東西時,似乎甚至沒有訪問該插件。 輸出結果如下:

[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Building {repository_name} 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.132 s
[INFO] Finished at: 2017-08-10T12:07:46-04:00
[INFO] Final Memory: 8M/309M
[INFO] ------------------------------------------------------------------------

為什么surefire甚至不會啟動? 我的設置有什么問題?

這是我的POM的插件部分,在這里我嘗試指定要使用的套件。 我假設這是在命令行參數中定義的。

<plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.20</version>
            <configuration>
                <suiteXmlFiles>
                    <suiteXmlFile>${suiteXMLFile}</suiteXmlFile>
                </suiteXmlFiles>
                <properties>
                    <property>
                        <name>usedefaultlisteners</name>
                        <value>false</value>
                    </property>
                    <property>
                        <name>listener</name>
                        <value>${listener-list}</value>
                    </property>
                </properties>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.3</version>
            <configuration>
                <encoding>UTF-8</encoding>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.6</version>
            <executions>
                <execution>
                    <goals>
                        <goal>test-jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>2.4</version>
            <executions>
                <execution>
                    <id>attach-sources</id>
                    <phase>verify</phase>
                    <goals>
                        <goal>jar-no-fork</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>

我發現的一種解決方案是將“ execution”塊包含在surefire中,因此在配置塊之后添加的其他幾行將是

 <executions>
     <execution>
         <id>run-tests</id>
         <phase>test</phase>
         <goals>
             <goal>test</goal>
         </goals>
     </execution>
 </executions>

固定的surefire沒有顯示,但是嘗試使用我的特定套件XML文件時仍然有問題。

一個猜測:您的pom.xml包含<packaging>pom</packaging>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM