2

I'm trying to get pre and post integration phase to work with maven, to no avail. My goal is to set up and tear down integration tests by running some binaries that are necessary. I'm testing with antrun-plugin and exec-plugin, but none of them prints the messages.

I'm running mvn verify. If I bind the plugins to clean phase and run mvn clean, the echo message and the ls are shown.

What's wrong? I'm using maven3

<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.12.3</version>
                <executions>
                    <execution>
                        <id>integration-test</id>
                        <goals>
                            <goal>integration-test</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>verify</id>
                        <goals>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <executions>
                    <execution>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <executable>ls</executable>
                    <arguments>
                        <argument>-la</argument>
                    </arguments>
                </configuration>
            </plugin>

            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.7</version>
                <executions>
                    <execution>
                        <id>xxx</id>
                        <configuration>
                            <target>
                                <echo>Cleaning deployed website</echo>
                            </target>
                        </configuration>

                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
Miguel Ping
  • 18,082
  • 23
  • 88
  • 136

1 Answers1

0

I helped someone else get the failsafe plugin configured correctly earlier. Try explicitly specifying the phases in the failsafe plugin executions. Not sure why that is needed, as the failsafe plugin docs say the goals are supposed to be bound to correct phases by default - but it seems to be.

Community
  • 1
  • 1
user944849
  • 14,524
  • 2
  • 61
  • 83