Configuration

Record Java application with RevDeBug

Estimated reading time: 4 mins

Last edited: 08 Mar 2020

Requirements

Required knowledge:

Other requirements:

  • Java version: RevDeBug is compatible with java version 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/build.gradle file in the root node of your Java application:

pom.xml

<project>
...
    <repositories>
            <repository>
                <id>rdb-repo</id>
                <name>RevDeBug Maven Repo</name>
                 <url>https://maven.revdebug.com</url>
            </repository>
        </repositories>
...
</project>
        
build.gradle

repositories {
    maven {
        url 'https://maven.revdebug.com'
    }
}
    
Adding RevDeBug dependencies

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

pom.xml

    <project>
    ...
    <dependencies>
            <dependency>
                <groupId>com.revdebug</groupId>
                <artifactId>compiler</artifactId>
                <version>5.7.1</version>
            </dependency>
            <dependency>
                <groupId>com.revdebug</groupId>
                <artifactId>RevDeBug</artifactId>
                <version>5.7.1</version>
            </dependency>
        </dependencies>
    ...
    </project> 
        
build.gradle

 dependencies {
    compileOnly 'com/revdebug:compiler:5.7.1'
    implementation 'com/revdebug:RevDeBug:5.7.1'
}

//* compile keyword instead of implementation for Gradle version less //than 3.0

//* compile keyword instead of compileOnly for Gradle version less than //2.12
 
    
Configuration connection to RevDeBug DevOps Monitor

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 single project open project’s pom.xml file and add following configuration lines to your existing pom section, or create new.
pom.xml

<plugins>
    <plugin>
        <groupId>pl.project13.maven</groupId>
        <artifactId>git-commit-id-plugin</artifactId>
        <version>4.0.0</version>
        <executions>
            <execution>
                <id>get-the-git-infos</id>
                <goals>
                    <goal>revision</goal>
                </goals>
                <phase>validate</phase>
            </execution>
        </executions>
    </plugin>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
            <compilerArgs>
    <arg>-ArecordServerAddress=[SERVER_ADDRESS]</arg>
    <arg>-ArecordServerPort=42734</arg>
                <arg>-ArecordingMode=OnEvent</arg>
                <arg>-AapplicationName=[APP_NAME]</arg>
                <arg>-AsolutionName=[PROJECT_NAME]</arg>                   
    <arg>-ArepositoryPath=target/Metadata</arg>
                <arg>-AuploadMetadata=true</arg>
                <arg>-AreleaseId=${git.commit.id}</arg>
            </compilerArgs>
            <source>1.8</source>
            <target>1.8</target>
        </configuration>
    </plugin>
</plugins>
            
To add RevDeBug to all projects open super pom.xml file and add following configuration lines to your existing pom section, or create new.
pom.xml

<project>
<build>
...
<pluginManagement>
        <plugins>
            <plugin>
                <groupId>pl.project13.maven</groupId>
                <artifactId>git-commit-id-plugin</artifactId>
                <version>4.0.0</version>
                <executions>
                    <execution>
                        <id>get-the-git-infos</id>
                        <goals>
                            <goal>revision</goal>
                        </goals>
                        <phase>validate</phase>
                    </execution>
                </executions>
            </plugin>    
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <compilerArgs>
        <arg>-ArecordServerAddress=[SERVER_ADDRESS]</arg>
        <arg>-ArecordServerPort=42734</arg>
                        <arg>-ArecordingMode=OnEvent</arg>
                        <arg>-AapplicationName=[APP_NAME]</arg>
                        <arg>-AsolutionName=[PROJECT_NAME]</arg>                   
                        <arg>-ArepositoryPath=target/Metadata</arg>
                        <arg>-AuploadMetadata=true</arg>
                        <arg>-AreleaseId=${git.commit.id}</arg>
                    </compilerArgs>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
</plugins>
</pluginManagement>
…
</build>
</project> 
        
build.gradle

    compileJava {
        options.compilerArgs = [
                "-ArecordServerAddress=[SERVER_ADDRESS]",
                "-ArecordServerPort=42734",
                "-ArecordingMode=OnEvent",
                "-AapplicationName=[APP_NAME]",
                "-AsolutionName=[PROJECT_NAME]",
                "-ArepositoryPath=${buildDir}/Metadata",
                "-AuploadMetadata=true"
    ]} 
            

There are seven customizable fields in RevDeBug DevOps Monitor connection section:

  • ArecordServerAddress:

    Here you have to enter your recording servers IP address or hostname (If you’re using Docker use the Ifconfig command to get the IP address)

  • ArecordServerPort:42734

    Default port to connect to RevDeBug DevOps Monitor.

  • ArecordingMode:

    RevDeBug offers two ways to record your applications:

    • OnEvent - records only a set amount of steps back (1.000 by default) and the bug itself. This mode is very light and fits well for production use.
    • Continuous - records everything that has occurred in the application including every line of code executed, every variable value, every exception and the performance data. This mode is suggested to be used only locally in the testing environment.
  • AapplicationName:

    Here you have to enter your application name.

  • AsolutionName:

    Here you have to enter your working java directory name.

  • ArepositoryPath:

    Path to your RevDeBug recordings directory.

  • AuploadMetadata:

    This option allows you to see recordings in RevDeBug DevOps Monitor