SmashedBug
SmashedBug

Reputation: 23

Why is maven surefire not even running?

I've been trying to split a repository to run specific tests, and I've had some issues with running the tests due to surefire.

When trying to run anything by even simply calling mvn test, it seems like that plugin is not even being accessed. The output ends up as:

[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] ------------------------------------------------------------------------

Why would surefire not even start up? What could be wrong with my setup?

This is my plugins section of my POM, where I try to specify the suite to use. I assume that is defined in the command line arguments.

<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>

Upvotes: 1

Views: 109

Answers (2)

Robert Scholte
Robert Scholte

Reputation: 12345

A guess: your pom.xml contains <packaging>pom</packaging>

Upvotes: 1

SmashedBug
SmashedBug

Reputation: 23

One solution that I found was to include the "execution" block onto surefire, so the additional few lines added after the configuration block would be

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

That fixed surefire not showing, but I'm still having an issue when trying to use my specific suite XML file.

Upvotes: 0

Related Questions