Skip to content

Repository files navigation

LionTech Resorts

LionTech Resorts is a Spring Boot hotel management web application built with Maven and packaged as a .war for Apache Tomcat.

Features

  • Account creation and secure login
  • Public room catalog with premium room photography
  • Global booking workflow with guest country, language, currency, and special requests
  • Checkout flow with a fake payment processor
  • Booking confirmation and masked card storage
  • Admin room management and full room catalog seeding
  • Facilities and amenities management through seeded data
  • Language service with English, French, Spanish, and Haitian Creole support
  • H2 fake database service for realistic persistence during demos
  • Health endpoint for deployment monitoring

Technology

  • Java 17
  • Spring Boot 3.4
  • Maven
  • Thymeleaf
  • Spring Security
  • Spring Data JPA
  • H2 database
  • WAR deployment to Tomcat

Build

This project requires JDK 17 or newer. If Maven prints release version 17 not supported, the build server is using Java 8 or 11 instead of JDK 17+.

On Ubuntu-based Jenkins or Maven servers:

sudo apt-get update
sudo apt-get install -y openjdk-17-jdk maven
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
export PATH="$JAVA_HOME/bin:$PATH"
java -version
mvn -version
mvn clean package

The deployable WAR is created at:

target/liontech-resorts.war

Jenkins CI/CD

This repository includes two Jenkins pipeline options:

Jenkinsfile
Jenkinsfile.scripted

Both pipelines run checkout, JDK/Maven tool setup, unit tests, Jacoco coverage, SonarQube analysis, quality gate validation, WAR packaging, Nexus publishing, and optional Tomcat deployment.

Recommended Jenkins tools and credentials:

JDK tool: jdk17 -> /usr/lib/jvm/java-17-openjdk-amd64
Maven tool: maven3.9.16
SonarQube URL parameter: SONAR_HOST_URL
SonarQube token credential: sonarqube-token
Nexus username/password credential: nexus-credentials
Tomcat Manager username/password credential: tomcat-manager

In Jenkins, configure the JDK under Manage Jenkins > Tools > JDK installations using the name jdk17. Set JAVA_HOME to the JDK root, such as /usr/lib/jvm/java-17-openjdk-amd64, not /usr/lib/jvm/java-17-openjdk-amd64/bin and not /usr/bin/java. The pipeline parameters let you override the SonarQube URL, Nexus URLs, Tomcat URL, tool names, and credential IDs without editing the Jenkinsfiles.

If the Jenkins tool named jdk17 exists but points to an invalid wrapper directory, nested auto-install directory, bin directory, or the java executable, the pipeline normalizes it back to the JDK root when possible. If that tool home is still unusable, the pipeline discards it and falls back to local JDK discovery using common OpenJDK 17 installation paths such as /usr/lib/jvm/java-17-openjdk-amd64. If the Maven tool named maven3.9.16 does not exist, it falls back to mvn from PATH.

The pipeline accepts only full JDK homes that contain both $JAVA_HOME/bin/java and $JAVA_HOME/bin/javac. JRE-only homes such as /usr/lib/jvm/java-21-openjdk-amd64 without bin/javac are skipped. The selected compiler is passed directly to Maven with -Dmaven.compiler.executable, so Jenkins cannot accidentally compile with an older system javac.

The pipeline runs SonarQube directly with Maven and SONAR_HOST_URL; it does not require a Jenkins global SonarQube server installation named SonarQube. The default SONAR_HOST_URL is http://52.91.204.64:9000. Create a Jenkins secret text credential named sonarqube-token with the project token.

Jenkins Freestyle Jobs

If your Jenkins job says Build step 'Invoke top-level Maven targets', Jenkins is running a Freestyle job and does not use Jenkinsfile.

For a Freestyle job:

Manage Jenkins > Tools > JDK installations:
Name: jdk17
JAVA_HOME: /usr/lib/jvm/java-17-openjdk-amd64

Job > Configure > General:
JDK: jdk17

Job > Configure > Build > Invoke top-level Maven targets:
Maven Version: maven3.9.16
Goals: clean verify

Do not leave the job JDK set to System if the system Java is older than 17. Confirm the Jenkins build console shows Java 17 or newer before Maven compiles:

java -version
javac -version
mvn -version

SonarQube Analysis

The Maven build includes the SonarQube scanner plugin and Jacoco XML coverage reporting. Provide the SonarQube URL and token from your shell or CI secret store:

export SONAR_HOST_URL='http://52.91.204.64:9000'
export SONAR_TOKEN='replace-with-sonarqube-token'
mvn clean verify sonar:sonar \
  -Dsonar.host.url="$SONAR_HOST_URL" \
  -Dsonar.token="$SONAR_TOKEN"

Jacoco generates the XML and HTML reports at:

target/site/jacoco/jacoco.xml
target/site/jacoco/index.html

The project key is configured as:

liontech-resorts

Publish WAR to Nexus

The POM is configured with Maven distributionManagement repository IDs:

nexus-releases
nexus-snapshots

Copy maven-settings.example.xml to your Maven settings location or pass it with -s, then provide Nexus credentials and repository URLs from environment variables:

export NEXUS_USERNAME='deployment-user'
export NEXUS_PASSWORD='replace-with-nexus-password'
export NEXUS_RELEASES_URL='http://nexus.example.com:8081/repository/maven-releases/'
export NEXUS_SNAPSHOTS_URL='http://nexus.example.com:8081/repository/maven-snapshots/'

mvn -s maven-settings.example.xml clean deploy

For a Nexus staging repository, also provide the base Nexus URL and enable the profile:

export NEXUS_URL='http://nexus.example.com:8081/'
mvn -s maven-settings.example.xml -Pnexus-staging clean deploy

Deploy to Tomcat

Use the deployment helper to clean out any stale exploded app directory, copy the WAR, restart Tomcat, and check the application URL:

mvn clean package
chmod +x scripts/deploy-tomcat.sh
./scripts/deploy-tomcat.sh

If deploying manually, remove the old exploded directory and WAR before copying the new WAR:

sudo systemctl stop tomcat10
sudo install -d -o tomcat -g tomcat -m 0750 /var/lib/liontech-resorts/data
sudo mkdir -p /etc/systemd/system/tomcat10.service.d
sudo tee /etc/systemd/system/tomcat10.service.d/liontech-resorts.conf >/dev/null <<'EOF'
[Service]
Environment="LIONTECH_DB_URL=jdbc:h2:file:/var/lib/liontech-resorts/data/liontech-resorts;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE;DEFAULT_NULL_ORDERING=HIGH"
Environment="LIONTECH_DB_USERNAME=sa"
Environment="LIONTECH_DB_PASSWORD="
EOF
sudo systemctl daemon-reload
sudo rm -rf /var/lib/tomcat10/webapps/liontech-resorts /var/lib/tomcat10/webapps/liontech-resorts.war
sudo cp target/liontech-resorts.war /var/lib/tomcat10/webapps/
sudo systemctl start tomcat10

Then open:

http://localhost:8080/liontech-resorts/

If Tomcat still returns 404, the WAR likely failed during startup. Check:

sudo journalctl -u tomcat10 -n 120 --no-pager
sudo tail -n 120 /var/log/tomcat10/catalina.out

Local Run

The app is still executable for local development:

mvn spring-boot:run

Open:

http://localhost:8080/

Demo Admin

Default seeded admin:

Email: admin@liontechresorts.com
Password: Admin@12345!

For production, override the default password:

export LIONTECH_ADMIN_PASSWORD='replace-with-a-strong-password'

Fake Database

By default the application uses an H2 file database:

${java.io.tmpdir}/liontech-resorts/liontech-resorts.mv.db

Override it with environment variables:

export LIONTECH_DB_URL='jdbc:h2:file:/var/lib/liontech-resorts/data/liontech-resorts'
export LIONTECH_DB_USERNAME='sa'
export LIONTECH_DB_PASSWORD='change-me'

The application seeds realistic rooms, amenities, facilities, and an admin account on first startup.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages