Ce contenu n'est pas disponible dans la langue sélectionnée.

Chapter 15. Building and running the employee rostering starter application


You can build the employee rostering starter application from the source code and run it as a JAR file.

Alternatively, you can use your IDE, for example, Eclipse (including Red Hat CodeReady Studio), to build and run the application.

15.1. Preparing deployment files

You must download and prepare the deployment files before building and deploying the application.

Procedure

  1. Download the rhdm-7.10.0-reference-implementation.zip file from the Software Downloads page for Red Hat Decision Manager 7.10.
  2. Unzip the downloaded archive.
  3. Copy the contents of the jboss-rhba-7.10.0.GA-maven-repository/maven-repository subdirectory into the ~/.m2/repository directory.
  4. Expand the rhdm-7.10.0-optaweb-employee-rostering.zip file that is extracted from the reference implementation archive.

    The optaweb-employee-rostering-distribution-7.48.0.Final-redhat-00004 folder is created. This folder is the base folder in subsequent parts of this document.

    Note

    File and folder names might have higher version numbers than specifically noted in this document.

You can run the Employee Rostering starter application from a JAR file included in the reference implementation download.

Prerequisites

  • You have downloaded and extracted the rhdm-7.10.0-reference-implementation.zip file as described in Section 15.1, “Preparing deployment files”.
  • A Java Development Kit is installed.
  • Maven is installed.
  • The host has access to the Internet. The build process uses the Internet for downloading Maven packages from external repositories.

Procedure

  1. In a command terminal, change to the sources directory.
  2. Enter the following command:

    mvn clean install -DskipTests
    Copy to Clipboard Toggle word wrap
  3. Wait for the build process to complete.
  4. Navigate to the optaweb-employee-rostering-distribution-7.48.0.Final-redhat-00004/sources/optaweb-employee-rostering-standalone/target directory.
  5. Enter the following command to run the Employee Rostering JAR file:

    java -jar optaweb-employee-rostering-standalone-*-exec.jar
    Copy to Clipboard Toggle word wrap
    Note

    This command starts the employee rostering application with a non-production database. To start the employee rostering application with a production database, add the --spring.profiles.active=production argument to the preceding command.

  6. To access the application, enter http://localhost:8080/ in a web browser.

You can use the command line to build and run the employee rostering starter application.

If you use this procedure, the data is stored in memory and is lost when the server is stopped. To build and run the application with a database server for persistent storage, see Section 15.4, “Building and running the employee rostering starter application with persistent data storage from the command line”.

Prerequisites

  • You prepared the deployment files as described in Section 15.1, “Preparing deployment files”.
  • A Java Development Kit is installed.
  • Maven is installed.
  • The host has access to the Internet. The build process uses the Internet for downloading Maven packages from external repositories.

Procedure

  1. Navigate to the optaweb-employee-rostering-backend directory.
  2. Enter the following command:

    mvn spring-boot:run
    Copy to Clipboard Toggle word wrap
  3. Navigate to the optaweb-employee-rostering-frontend directory.
  4. Enter the following command:

    npm start
    Copy to Clipboard Toggle word wrap
    Note

    If you use npm to start the server, npm monitors code changes.

  5. To access the application, enter http://localhost:3000/ in a web browser.

If you use the command line to build the employee rostering starter application and run it, you can provide a database server for persistent data storage.

Prerequisites

  • You prepared the deployment files as described in Section 15.1, “Preparing deployment files”.
  • A Java Development Kit is installed.
  • Maven is installed.
  • The host has access to the Internet. The build process uses the Internet for downloading Maven packages from external repositories.
  • You have a deployed MySQL or PostrgeSQL database server.

Procedure

  1. In a command terminal, navigate to the optaweb-employee-rostering-standalone/target directory.
  2. Enter the following command to run the Employee Rostering JAR file:

    java -jar optaweb-employee-rostering-standalone-*-exec.jar --spring.profiles.active=production
    spring.datasource.url=<DATABASE_URL> --spring.datasource.username=<DATABASE_USER> --spring.datasource.password=<DATABASE_PASSWORD>
    Copy to Clipboard Toggle word wrap

    In this example, replace the following placeholders:

    • <DATABASE_URL>: URL to connect to the database, for example jdbc:postgresql://postgresql:5432/MY_DATABASE
    • <DATABASE_USER>: The user to connect to the database
    • <DATABASE_PASSWORD>: The password for <DATABASE_USER>

You can use IntelliJ IDEA to build and run the employee rostering starter application.

Prerequisites

  • You have downloaded the Employee Rostering source code, available from the Employee Rostering GitHub page.
  • IntelliJ IDEA, Maven, and Node.js are installed.
  • The host has access to the Internet. The build process uses the Internet for downloading Maven packages from external repositories.

Procedure

  1. Start IntelliJ IDEA.
  2. From the IntelliJ IDEA main menu, select File Open.
  3. Select the root directory of the application source and click OK.
  4. From the main menu, select Run Edit Configurations.
  5. In the window that appears, expand Templates and select Maven. The Maven sidebar appears.
  6. In the Maven sidebar, select optaweb-employee-rostering-backend from the Working Directory menu.
  7. In Command Line, enter spring-boot:run.
  8. To start the back end, click OK .
  9. In a command terminal, navigate to the optaweb-employee-rostering-frontend directory.
  10. Enter the following command to start the front end:

    npm start
    Copy to Clipboard Toggle word wrap
  11. To access the application, enter http://localhost:3000/ in a web browser.
Retour au début
Red Hat logoGithubredditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance. Découvrez nos récentes mises à jour.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez le Blog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

Theme

© 2025 Red Hat