Java 为什么maven surefire甚至没有运行?

Java 为什么maven surefire甚至没有运行?,java,maven,pom.xml,maven-surefire-plugin,Java,Maven,Pom.xml,Maven Surefire Plugin,我一直在尝试拆分存储库以运行特定的测试,但由于surefire的原因,我在运行测试时遇到了一些问题 当试图通过调用mvn test来运行任何东西时,似乎该插件甚至没有被访问。输出结果如下: [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building {repository_name} 0

我一直在尝试拆分存储库以运行特定的测试,但由于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>

org.apache.maven.plugins
maven surefire插件
2.20
${suiteXMLFile}
usedefaultlisteners
假的
听众
${listener list}
org.apache.maven.plugins
maven编译器插件
3.3
UTF-8
1.8
1.8
org.apache.maven.plugins
maven jar插件
2.6
试验罐
org.apache.maven.plugins
maven源插件
2.4
附加来源
验证
罐子没有叉子

我发现的一个解决方案是将“执行”块包含到surefire中,因此在配置块之后添加的额外几行将是

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

运行测试
测试
测试

修复了surefire未显示的问题,但我在尝试使用特定的套件XML文件时仍然存在问题。

我发现的一个解决方案是将“执行”块包含到surefire中,因此在配置块之后添加的额外几行将被删除

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

运行测试
测试
测试

修复了surefire没有显示的问题,但我在尝试使用我的特定套件XML文件时仍然有问题。

猜测:您的
pom.XML
包含
pom

猜测:您的
pom.XML
包含
pom

猜测:您的
pom.XML
包含
pom
就是这样!!!!我从一个存储库中移动测试,并复制到父pom上。这一定导致没有一项测试被接受。非常感谢。猜一猜:你的
pom.xml
包含
pom
就是这样!!!!我从一个存储库中移动测试,并复制到父pom上。这一定导致没有一项测试被接受。非常感谢。