0

I'm working on getting an integration test working but for some reason maven-failsafe-plugin is not running. Below is the profile being used for the integration test. And the name of the test class is AppSmokeTestIT.java. @Test is being used for the tests.

<profiles>
    <profile>
        <id>default</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>${maven.war.version}</version>
                    <configuration>
                        <archive>
                            <manifest>
                                <addClasspath>true</addClasspath>
                            </manifest>
                        </archive>
                        <packagingExcludes>${package.excludes}</packagingExcludes>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>
    <profile>
        <id>smoke-test</id>
        <build>
            <finalName>APP</finalName>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>${build.helper.maven.version}</version>
                    <executions>
                        <execution>
                            <id>reserve-network-port</id>
                            <goals>
                                <goal>reserve-network-port</goal>
                            </goals>
                            <phase>process-resources</phase>
                            <configuration>
                                <portNames>
                                    <portName>tomcat.http.port</portName>
                                </portNames>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.tomcat.maven</groupId>
                    <artifactId>tomcat7-maven-plugin</artifactId>
                    <version>${tomcat.maven.version}</version>
                    <configuration>
                        <port>${tomcat.http.port}</port>
                        <path>/${project.build.finalName}</path>
                        <additionalConfigFilesDir>${basedir}/src/test/resources/tomcatconf</additionalConfigFilesDir>
                    </configuration>
                    <executions>
                        <execution>
                            <id>start-server</id>
                            <configuration>
                                <fork>true</fork>
                            </configuration>
                            <phase>pre-integration-test</phase>
                            <goals>
                                <goal>run</goal>h
                            </goals>
                        </execution>
                        <execution>
                            <id>stop-server</id>
                            <configuration>
                            </configuration>
                            <phase>post-integration-test</phase>
                            <goals>
                                <goal>shutdown</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${maven.failsafe.version}</version>
                    <configuration>
                        <systemPropertyVariables>
                            <integration-test.url>${tomcat.local.host}${tomcat.http.port}/${project.build.finalName}/</integration-test.url>
                        </systemPropertyVariables>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.apache.maven.surefire</groupId>
                            <artifactId>surefire-junit47</artifactId>
                            <version>${maven.failsafe.version}</version>
                        </dependency>
                    </dependencies>
                    <executions>
                        <execution>
                            <goals>
                                <goal>integration-test</goal>
                                <goal>verify</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>${maven.war.version}</version>
                    <configuration>
                        <archive>
                            <manifest>
                                <addClasspath>true</addClasspath>
                            </manifest>
                        </archive>
                        <packagingExcludes>${package.excludes}</packagingExcludes>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

I have looked at multiple post about this issue and >have done the following

I've tried just running the plugin in build tags.

I've tried adding

<includes>
    <include>**/*IT.java</include>
</includes>

I've also tried running maven-failsafe-plugin version 2.18.1 instead as I saw someone with this issue suggesting it worked for them.

Spinners
  • 1
  • 6
  • can you make an example project on Github which shows the problem..from these snippets it's hard to guess what the real problem is... – khmarbaise Dec 06 '18 at 15:37
  • Try the [answer here](https://stackoverflow.com/a/9949341/944849). In particular, note the plugin configuration. – user944849 Dec 06 '18 at 17:58

1 Answers1

0

Sorry for wasting your time guys. Had a brain fart yesterday and realised this morning that I didn't have the required profile selected when running the clean install.

Spinners
  • 1
  • 6