---
title: Sample stage
description: You can download a sample custom stage project with the minimum classes and project file required for any self-service stage. The sample project implements a stage named MathProblem, which generates a simple math problem that must be completed to progress to the next stage.
component: pingidm
version: 7.5
page_id: pingidm:self-service-reference:custom-stage-requirements
canonical_url: https://docs.pingidentity.com/pingidm/7.5/self-service-reference/custom-stage-requirements.html
keywords: ["Configuration", "Authentication", "Self-Service", "User Self-Service"]
section_ids:
  custom-stage-building: Build the sample stage
---

# Sample stage

You can [download a sample custom stage project](https://backstage.forgerock.com/downloads/browse/source-code/all) with the minimum classes and project file required for any self-service stage. The sample project implements a stage named `MathProblem`, which generates a simple math problem that must be completed to progress to the next stage.

The project includes the following files, required for any custom self-service stage:

* Maven project file (`pom.xml`)

  Pay particular attention to the `maven-bundle-plugin` in this file:

  ```xml
  <plugins>
      <plugin>
          <groupId>org.apache.felix</groupId>
          <artifactId>maven-bundle-plugin</artifactId>
          <extensions>true</extensions>
          <configuration>
              <instructions>
                  <Fragment-Host>org.forgerock.openidm.selfservice</Fragment-Host>
              </instructions>
          </configuration>
      </plugin>
  </plugins>
  ```

  This plugin indicates that Apache Felix should attach the custom stage artifact to IDM's self-service bundle.

* *configuration class*

  (`src/main/java/org/forgerock/selfservice/custom/MathProblemStageConfig.java`)

  The configuration class reads configuration data from a corresponding configuration (JSON) file. The class represents each configuration item for the stage as properties of the class.

* *implementation class*

  (`src/main/java/org/forgerock/selfservice/custom/MathProblemStage.java`)

  The implementation class is the main orchestration class for the stage.

## Build the sample stage

To build the sample stage, you must have [Apache Maven](https://maven.apache.org/install.html) installed.

1. Sign on to [Backstage](https://backstage.forgerock.com/downloads/browse/source-code/all).

2. On the All Downloads tab, select commons, select the applicable version, and click GET.

   |   |                                                                                                                                              |
   | - | -------------------------------------------------------------------------------------------------------------------------------------------- |
   |   | Typically, you should select the latest version supported by your version of IDM. This version of IDM works with ForgeRock Commons `26.3.x`. |

   > **Collapse: Show Me**
   >
   > ![Download ForgeRock Commons source code](_images/download-commons-source-code.png)

3. In the Download modal, click Download.

4. Extract the downloaded zip file.

5. In a terminal window, change to the extracted custom stage directory:

   ```bash
   cd /path/to/extracted-directory/commons-version/self-service/forgerock-selfservice-stages
   ```

6. Build the sample stage:

   ```bash
   mvn clean install
   [INFO] Scanning for projects...
   ...
   [INFO]
   [INFO] ------< org.forgerock.commons:forgerock-selfservice-custom-stage >------
   [INFO] Building A Custom Stage Bundle version
   [INFO]   from pom.xml
   [INFO] -------------------------------[ bundle ]-------------------------------
   ...
   [INFO] ------------------------------------------------------------------------
   [INFO] BUILD SUCCESS
   [INFO] ------------------------------------------------------------------------
   [INFO] Total time:  42.529 s
   [INFO] Finished at: 2025-12-23T10:23:09-08:00
   [INFO] ------------------------------------------------------------------------
   ```

7. Copy the compiled sample stage to the `openidm/bundle` directory:

   ```bash
   cp target/forgerock-selfservice-custom-stage-version.jar /path/to/openidm/bundle/
   ```

8. Restart IDM.
