-->

Maven ant task not getting executed while running

2019-08-29 16:52发布

问题:

We are trying to set up cucumber framework tests. We started with sample tests and it ran fine. I then updated maven to have maven profiles which will do certain tasks specific to that profile. I have profile QA_Smoke and have ant task under it ( for now simple echo) . I have set this profile as active maven profile but whenever I run the profile , task does not get executed. Instead it directly starts cucumber tests. Below is snapshot of maven profile.Can someone please tell,how can we execute maven tasks first then start cucumber tests-

<profile>
        <id>QA1_Smoke</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>1.6</version>
                    <executions>
                        <execution>
                            <phase>test</phase>
                            <goals>
                                <goal>run</goal>
                            </goals>
                            <configuration>
                                <tasks>
                                    <echo>**********Running QA1 Smoke Tests*******************</echo>

                                </tasks>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>

Further investigation shows that task is getting executed but after cucumber test execution. I would like to get this task executed first and then run cucumber tests. Any thoughts ? how can we do this ?