user3830534
user3830534

Reputation: 15

maven build fails but allure report is generated

My Allure local report gets generated but the maven build fails. Can anyone help me fix this issue? Attached here is my POM and the maven failure message. POM:

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <targetJdk>1.7</targetJdk>
    <hudson.version>2.1.2</hudson.version>
    <maven-surefire-plugin.version>2.16</maven-surefire-plugin.version>
    <selenium.version>2.45.0</selenium.version>
    <selenium-driver.version>2.44.0</selenium-driver.version>
    <slf4j.version>1.7.5</slf4j.version>
    <acceptance.framework.acceptance>0.0.5-SNAPSHOT</acceptance.framework.acceptance>
    <acceptance.shared.acceptance>0.0.5-SNAPSHOT</acceptance.shared.acceptance>
    <junit.version>4.11</junit.version>
    <commons-lang3.version>3.1</commons-lang3.version>
    <aspectj.version>1.7.4</aspectj.version>
    <allure.version>1.4.20</allure.version>
    <allure-maven-plugin.version>2.2</allure-maven-plugin.version>
    <webdriver.ie64.driver>${settings.localRepository}/org/seleniumhq/selenium/selenium-ie-driver-server-x64/${selenium-driver.version}/selenium-ie-driver-server-x64-${selenium-driver.version}.exe</webdriver.ie64.driver>
    <webdriver.ie32.driver>${settings.localRepository}/org/seleniumhq/selenium/selenium-ie-driver-server-32/${selenium-driver.version}/selenium-ie-driver-server-32-${selenium-driver.version}.exe</webdriver.ie32.driver>
    <webdriver.chrome.driver>${settings.localRepository}/org/seleniumhq/selenium/selenium-chrome-driver-server/${selenium-driver.version}/selenium-chrome-driver-server-${selenium-driver.version}.exe</webdriver.chrome.driver>
</properties>
<dependencies>
    <dependency>
        <groupId>com.cccis.testing.acceptance</groupId>
        <artifactId>acceptance-shared</artifactId>
        <version>${acceptance.shared.acceptance}</version>
    </dependency>
    <dependency>
        <groupId>com.cccis.testing.acceptance</groupId>
        <artifactId>acceptance-framework</artifactId>
        <version>${acceptance.framework.acceptance}</version>
    </dependency>
    <dependency>
        <groupId>ru.yandex.qatools.allure</groupId>
        <artifactId>allure-junit-adaptor</artifactId>
        <version>${allure.version}</version>
    </dependency>
    <dependency>
        <groupId>ru.yandex.qatools.allure</groupId>
        <artifactId>allure-maven-plugin</artifactId>
        <version>${allure-maven-plugin.version}</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${slf4j.version}</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>${slf4j.version}</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-server</artifactId>
        <version>${selenium.version}</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-ie-driver-server-x64</artifactId>
        <version>${selenium-driver.version}</version>
        <type>exe</type>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-ie-driver-server-32</artifactId>
        <version>${selenium-driver.version}</version>
        <type>exe</type>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>commons-httpclient</groupId>
        <artifactId>commons-httpclient</artifactId>
        <version>3.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.3.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.pdfbox</groupId>
        <artifactId>pdfbox-app</artifactId>
        <version>1.6.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>${commons-lang3.version}</version>
    </dependency>
    <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-library</artifactId>
        <version>1.3</version>
    </dependency>
    <dependency>
        <groupId>org.jvnet.hudson.main</groupId>
        <artifactId>hudson-rest-model</artifactId>
        <version>${hudson.version}</version>
    </dependency>
</dependencies>
<reporting>
    <excludeDefaults>true</excludeDefaults>
    <plugins>
        <plugin>
            <groupId>ru.yandex.qatools.allure</groupId>
            <artifactId>allure-maven-plugin</artifactId>
        </plugin>
    </plugins>
</reporting>
<profiles>
    <profile>
        <id>QASmoke</id>
        <properties>
            <testcase.groups>testcategories.QASmokeTest</testcase.groups>
        </properties>
    </profile>
    <profile>
        <id>CTSmoke</id>
        <properties>
            <testcase.groups>testcategories.CTSmokeTest</testcase.groups>
        </properties>
    </profile>
    <profile>
        <id>PRODSmoke</id>
        <properties>
            <testcase.groups>testcategories.PRODSmokeTest</testcase.groups>
        </properties>
    </profile>
</profiles>
<build>
    <testResources>
        <testResource>
            <directory>src/test/resources/</directory>
            <excludes>
                <exclude>*.properties</exclude>
            </excludes>
            <filtering>false</filtering>
        </testResource>
        <testResource>
            <directory>src/test/resources/</directory>
            <includes>
                <include>*.properties</include>
            </includes>
            <filtering>true</filtering>
        </testResource>
        <testResource>
            <!-- Applies filtering to properties files, specifically maven.properties (this would be step 2 of 2). The files are output to target/test-resources. -->
            <directory>target/generated-test-resources/</directory>
            <includes>
                <include>*.properties</include>
            </includes>
            <filtering>true</filtering>
        </testResource>
    </testResources>
    <plugins>
        <plugin>
            <!-- Writes the properties from the maven config into a maven.properties file (in the target/generated-test-resources folder). Most importantly this will write out the webdriver.ie64.driver, 
                webdriver.ie32.driver, etc. properties. This is step 1 of 2 for this file. -->
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>properties-maven-plugin</artifactId>
            <executions>
                <execution>
                    <id>write-shared-properties</id>
                    <!-- This is specifically generate-resources instead of generate-test-resources to create the proper ordering. -->
                    <phase>generate-resources</phase>
                    <goals>
                        <goal>write-project-properties</goal>
                    </goals>
                    <inherited>true</inherited>
                    <configuration>
                        <outputFile>${project.build.directory}/generated-test-resources/maven.properties</outputFile>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>ru.yandex.qatools.allure</groupId>
            <artifactId>allure-maven-plugin</artifactId>
            <configuration>
                <resultsDirectory>allure-results</resultsDirectory>
                <reportDirectory>allure-report</reportDirectory>
            </configuration>
        </plugin>
    </plugins>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <!-- Fix a compilation issue related to JDK 7 -->
                    <argLine>-XX:-UseSplitVerifier</argLine>
                    <systemPropertyVariables>
                        <file.encoding>UTF-8</file.encoding>
                    </systemPropertyVariables>
                    <groups>${testcase.groups}</groups>
                    <testFailureIgnore>false</testFailureIgnore>
                    <argLine>
                        -javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar
                    </argLine>
                    <properties>
                        <property>
                            <name>listener</name>
                            <value>ru.yandex.qatools.allure.junit.AllureRunListener</value>
                        </property>
                    </properties>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>aspectjweaver</artifactId>
                        <version>${aspectj.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <!-- <plugin> <groupId>org.asciidoctor</groupId> <artifactId>asciidoctor-maven-plugin</artifactId> <version>1.5.2</version> <executions> <execution> <id>output-html</id> <phase>generate-resources</phase> 
                <goals> <goal>process-asciidoc</goal> </goals> </execution> </executions> </plugin> -->
            <plugin>
                <!-- Configures eclipse to run the project properties plugin so that Eclipse builds also create the maven.properties file. -->
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>${lifecycle-mapping.version}</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.codehaus.mojo</groupId>
                                    <artifactId>properties-maven-plugin</artifactId>
                                    <versionRange>1.0-alpha-2</versionRange>
                                    <goals>
                                        <goal>write-project-properties</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <execute />
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

Maven Goal: - clean test allure:report

Error:

Started InternetExplorerDriver server (32-bit)
2.44.0.0
Listening on port 29928
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 26.752 sec - in testscripts.SampleUITests

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO] 
[INFO] --- allure-maven-plugin:2.5:report (default-cli) @ sample-project-acceptance ---
[INFO] Generate Allure report (report) with version 1.4.20
[INFO] Generate Allure report to allure-report
[INFO] Found results directory C:\Users\siyer\workspace\sample-project-acceptance\target\allure-results
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 44.476 s
[INFO] Finished at: 2016-02-04T14:26:39-06:00
[INFO] Final Memory: 66M/347M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal ru.yandex.qatools.allure:allure-maven-plugin:2.5:report (default-cli) on project sample-project-acceptance: An error has occurred in Allure report generation. Could not generate the report: 'other' is different type of Path -> [Help 1]

Upvotes: 1

Views: 3297

Answers (1)

Thennisha
Thennisha

Reputation: 11

Changing the directory path to ABSOLUTE PATH in your pom.xml will work.

i.e., add ${project.basedir} to all directories

In pom.xml make changes as below

<build>
<testResources>
    <testResource>
        <directory>${project.basedir}/src/test/resources</directory>
        <excludes>
            <exclude>*.properties</exclude>
        </excludes>
        <filtering>false</filtering>
    </testResource>
    <testResource>
        <directory>${project.basedir}/src/test/resources</directory>
        <includes>
            <include>*.properties</include>
        </includes>
        <filtering>true</filtering>
    </testResource>
    <testResource>
    <!-- Applies filtering to properties files, specifically maven.properties (this would be step 2 of 2). The files are output to target/test-resources. -->
        <directory>${project.basedir}/target/generated-test-resources</directory>
        <includes>
            <include>*.properties</include>
        </includes>
        <filtering>true</filtering>
    </testResource>
</testResources>

Hope this will fix your issue.

Upvotes: 1

Related Questions