Maven

Record Java application with RevDeBug

Estimated reading time: 1 min

Last edited: 04 Nov 2019

Requirements

Required knowledge:

Other requirements:

  • Java version: RevDeBug is compatible with java version 7 and 8

  • Maven version: RevDeBug is compatible with Maven 2.0.1 or higher
  • Gradle version: RevDeBug is compatible with Gradle 1.0 or higher

  • any Java application - you can use our RevDeBug Java Demo application
Adding RevDeBug repository

Add following lines to super pom.xml file in the root node of your Java application:


    <project>
    ...
        <repositories>
                <repository>
                    <id>rdb-repo</id>
                    <name>RevDeBug Maven Repo</name>
                    <url>http://maven.revdebug.com</url>
                </repository>
            </repositories>
    ...
    </project>
    
Adding RevDeBug dependencies

Add RevDeBug dependencies by adding following lines to super pom.xml file in the root node:


    <project>
    ...
    <dependencies>
            <dependency>
                <groupId>com.revdebug</groupId>
        <!--if your target java version is 7 change to compiler7-->
                <artifactId>compiler8</artifactId>
                <version>5.1</version>
            </dependency>
            <dependency>
                <groupId>com.revdebug</groupId>
                <artifactId>RevDeBug</artifactId>
                <version>5.1</version>
            </dependency>
        </dependencies>
    ...
    </project> 
    
RevDeBug in all projects

RevDeBug can be easily added to all projects in your working directory. But if you want, you can add RevDeBug to selected subset.

To add RevDeBug to all projects open super pom.xml file and add following configuration lines to your existing pom section, or create new.


    <project>
    <build>
    ...
    <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.1</version>
                    <configuration>
                        <compilerArgs>
                        <arg>-processor</arg>
            <!--if your target java version is 7 change to compiler7-->
                            <arg>compiler8.ast.RevDeBugProcessor</arg>
            <arg>-ArecordServerAddress=[SERVER_ADDRESS]</arg>
            <arg>-ArecordServerPort=42734</arg>
                            <arg>-ArecordingMode=CrashRecorder</arg>
                            <arg>-AapplicationName=[APP_NAME]</arg>
                            <arg>-AsolutionName=[PROJECT_NAME]</arg>                   
            <arg>-ArepositoryPath=[STORAGE_PATH]</arg>
                            <arg>-AuploadMetadata=true</arg>
                        </compilerArgs>
                <!---if your target java version is 7 change source and target to 1.7-->
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>
    </plugins>
    </pluginManagement>
    …
    </build>
    </project> 
    
RevDeBug in a single project

To add RevDeBug to single project open project’s pom.xml file and add following configuration lines to your existing pom section, or create new.


    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <compilerArgs>
                    <arg>-processor</arg>
        <!--if your target java version is 7 change to compiler7-->
                    <arg>compiler8.ast.RevDeBugProcessor</arg>
        <arg>-ArecordServerAddress=[SERVER_ADDRESS]</arg>
        <arg>-ArecordServerPort=42734</arg>
                    <arg>-ArecordingMode=CrashRecorder</arg>
                    <arg>-AapplicationName=[APP_NAME]</arg>
                    <arg>-AsolutionName=[PROJECT_NAME]</arg>                   
        <arg>-ArepositoryPath=[STORAGE_PATH]</arg>
                    <arg>-AuploadMetadata=true</arg>	
                </compilerArgs>
            <!---if your target java version is 7 change source and target to 1.7-->
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>