Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Allure: Environment file in target folder gets deleted on maven clean. How do I generate it on every build?

The instructions say to add the environment.xml to the Allure results directory (https://github.com/allure-framework/allure-core/wiki/Environment) but this folder gets deleted on mvn clean so the files gets deleted with it. Is there a way to generate this file on every build?

Thanks.

like image 245
ihossain Avatar asked Mar 16 '23 09:03

ihossain


1 Answers

Just put in in your src/main/resources/ and copy to your results directory via maven resources plugin on mvn test or mvn site:

<plugin>
    <artifactId>maven-resources-plugin</artifactId>
    <executions>
        <execution>
            <id>copy-allure-environment</id>
            <phase>pre-site</phase>
            <goals>
                <goal>copy-resources</goal>
            </goals>
            <configuration>
                <outputDirectory>${basedir}/target/allure-results</outputDirectory>
                <resources>
                    <resource>
                        <directory>src/main/resources</directory>
                        <includes>
                            <include>environment.xml</include>
                        </includes>
                    </resource>
                </resources>
            </configuration>
        </execution>
    </executions>
</plugin>
like image 64
Innokenty Avatar answered Apr 06 '23 11:04

Innokenty