Setting up Allure in a Maven project involves three things: adding the dependency, configuring the Surefire plugin with AspectJ, and creating the allure.properties file. Do not skip any step — each one is critical.
<!-- pom.xml — Add these properties -->
<properties>
<allure.version>2.25.0</allure.version>
<aspectj.version>1.9.21</aspectj.version>
</properties>
<!-- Add to dependencies section -->
<dependencies>
<!-- Allure TestNG integration -->
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-testng</artifactId>
<version>${allure.version}</version>
<scope>test</scope>
</dependency>
<!-- Your existing dependencies stay as-is -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.21.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.10.2</version>
<scope>test</scope>
</dependency>
</dependencies>This is the part people mess up. The @Step annotation uses AspectJ to intercept method calls at runtime. Without the AspectJ weaver, your @Step annotations will be silently ignored — tests will run, but steps will not appear in the report.
<!-- pom.xml — Add to build > plugins section -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
</argLine>
<systemPropertyVariables>
<allure.results.directory>
${project.build.directory}/allure-results
</allure.results.directory>
</systemPropertyVariables>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>If you see @Step annotations being ignored (steps not showing in the report), 99% of the time it is because the AspectJ weaver is not configured. Check the argLine in Surefire. Also make sure the aspectjweaver version in argLine matches the dependency version exactly.
# src/test/resources/allure.properties
allure.results.directory=target/allure-results
allure.link.issue.pattern=https://jira.yourcompany.com/browse/{}
allure.link.tms.pattern=https://testlink.yourcompany.com/case/{}The link patterns are optional but very useful. When you use @Issue("BUG-123") in your test, Allure automatically creates a clickable link to https://jira.yourcompany.com/browse/BUG-123. Same for @TmsLink. Set these patterns once and every test gets clickable links for free.
After adding the Allure dependency, run "mvn dependency:tree | grep allure" to verify it was resolved. If you see version conflicts, use <dependencyManagement> to force the correct version.
Key Point: Allure setup needs three things: the dependency, the AspectJ weaver in Surefire, and allure.properties. Miss any one and it silently breaks.