Search code examples
mavenkotlingradlebuild.gradlemaven-plugin

How to convert a maven plugin into a gradle plugin (maven-surefire-puglin )?


I am trying to use this plugin but with gradle:

<properties>
    <aspectj.version>1.8.10</aspectj.version>
</properties>

<dependencies>
    <dependency>
        <groupId>io.qameta.allure</groupId>
        <artifactId>allure-junit4</artifactId>
        <version>LATEST_VERSION</version>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.20</version>
            <configuration>
                <testFailureIgnore>false</testFailureIgnore>
                <argLine>
                    -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
                </argLine>
                <properties>
                    <property>
                        <name>listener</name>
                        <value>io.qameta.allure.junit4.AllureJunit4</value>
                    </property>
                </properties>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.aspectj</groupId>
                    <artifactId>aspectjweaver</artifactId>
                    <version>${aspectj.version}</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>

Instead, if it is not really necessary (because there is any easier way on gradle to proceed) can someone give a clue on how to do it?


Solution

  • Have a look at the documentation on testing Java & JVM projects in Gradle. It should answer the basic questions around setting up testing in a Gradle project.

    However if you are using specific features of the maven-surefire-plugin that you fail to replicate, please amend your question with more specific elements.