### 0. Define section
### {buildroot} is by default ~/rpmbuild/BUILDROOT/{Name}-{Version}-{Release}
### 1. The introduction section
Name: my-test-app
Version: 0.0.1
Release: 1%{?dist}
Summary: my-test-app
Group: my-test-team
License: Commercial
URL: http://xxxx.com
Packager: abc@xxxx.com
Source0: my-test-app.tar.gz
# add Prefix and give a dummy value, the RPM will be relocatable, you can override prefix when installing RPM
# sudo rpm -ivh ~/rpmbuild/RPMS/x86_64/my-test-app-0.0.1.x86_64.rpm --prefix=/home/admin
Prefix: /
%description
my-test-app
### 2. The Prepare section
%prep
# This will unzip sources into ~/rpmbuild/BUILD folder
tar -xzvf %{sources}
### 3. The Build Section
%build
# Current folder is ~/rpmbuild/BUILD
cd ./my-test-app
mvn package -Dmaven.test.skip -Denv=release
### 4. Install Section
%install
mkdir -p %{buildroot}/my-test-app
rsync -av --exclude=**/*DS_Store manager/my-test-app/target/my-test-app/ %{buildroot}/my-test-app
### 5. The files to be packaged into RPM
%files
# Current folder is {buildroot}
/my-test-app
# These files will get the below permissions after you installed RPM
%attr(4755, admin, admin) /my-test-app/bin/*
%attr(4755, admin, admin) /my-test-app/script/*