53 lines
1.1 KiB
Bash
Executable File
53 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
if [ ! -f "pom.xml" ]; then
|
|
echo "Error: pom.xml not found. Please run this script from the project root."
|
|
exit 1
|
|
fi
|
|
|
|
echo "[1/5] Cleaning previous builds..."
|
|
mvn clean
|
|
echo "Clean completed"
|
|
echo ""
|
|
|
|
echo "[2/5] Compiling sources..."
|
|
mvn compile
|
|
echo "Compilation completed"
|
|
echo ""
|
|
|
|
echo "[3/5] Running tests..."
|
|
mvn test -DskipTests
|
|
echo "Tests completed (skipped)"
|
|
echo ""
|
|
|
|
echo "[4/5] Packaging WAR file..."
|
|
mvn package -DskipTests
|
|
echo "Packaging completed"
|
|
echo ""
|
|
|
|
if [ ! -f "target/is1.war" ]; then
|
|
echo "Error: WAR file not created. Build failed."
|
|
exit 1
|
|
fi
|
|
|
|
WAR_SIZE=$(ls -lh target/is1.war | awk '{print $5}')
|
|
echo "WAR file created: target/is1.war (${WAR_SIZE})"
|
|
echo ""
|
|
|
|
echo "[5/5] Deploying to WildFly..."
|
|
|
|
WILDFLY_DEPLOYMENTS="wildfly/standalone/deployments"
|
|
|
|
if [ -d "$WILDFLY_DEPLOYMENTS" ]; then
|
|
cp target/is1.war "$WILDFLY_DEPLOYMENTS/"
|
|
echo "WAR file copied to: $WILDFLY_DEPLOYMENTS/is1.war"
|
|
else
|
|
echo "WildFly deployments directory not found at: $WILDFLY_DEPLOYMENTS"
|
|
fi
|
|
|
|
echo ""
|
|
echo "Build successful"
|
|
echo "WAR file: target/is1.war (${WAR_SIZE})"
|
|
echo "Ready for deployment"
|
|
echo "" |