From da4f3ceb1fc1f317a3cca788b6c9b78ffab12de2 Mon Sep 17 00:00:00 2001 From: Kostya Date: Tue, 13 Oct 2026 19:19:40 +0300 Subject: tools: package the server as a WAR and the client as a directory The Ex3 submission is exactly one WAR for Tomcat's webapps/ plus a directory holding the client, its jars and its batch file. package.sh now stages both under build/dist/ex3. The WAR is named guess-market.war after the context path the client expects, and carries the api and service jars with gson and JAXB; Tomcat only has to provide the servlet API. The client directory holds ui-client, api, ui-fx, gson, OkHttp and JavaFX, and nothing of the engine. An executable's Class-Path used to name every module. List only the modules it depends on, so the client jar no longer points at service.jar, and stop producing a plain jar for the server module. Add tomcat.sh to try the result by hand: it copies the packaged WAR into a local Tomcat ($CATALINA_HOME, or the newest C:\tomcat\apache-tomcat-*) and runs it in the foreground. --- tools/tomcat.sh | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tools/tomcat.sh (limited to 'tools/tomcat.sh') diff --git a/tools/tomcat.sh b/tools/tomcat.sh new file mode 100644 index 0000000..05d38d2 --- /dev/null +++ b/tools/tomcat.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +set -e +cd "$(dirname "$0")/.." +. tools/_util.sh + +WAR="build/dist/ex3/$WAR_NAME.war" +[ -f "$WAR" ] || { + echo "No $WAR - run tools/package.sh first" + exit 1 +} + +TOMCAT="${CATALINA_HOME:-$(ls -d /c/tomcat/apache-tomcat-* 2>/dev/null | sort -V | tail -n 1)}" +case "$(uname -s)" in + CYGWIN*|MINGW*|MSYS*) TOMCAT=$(cygpath -u "$TOMCAT" 2>/dev/null || echo "$TOMCAT") ;; +esac +[ -d "$TOMCAT/webapps" ] || { + echo "No Tomcat found. Set CATALINA_HOME to a Tomcat 10.1+ folder (the one holding webapps/)." + exit 1 +} + +rm -rf "$TOMCAT/webapps/$WAR_NAME" "$TOMCAT/webapps/$WAR_NAME.war" +cp "$WAR" "$TOMCAT/webapps/" + +echo "=== Tomcat: $TOMCAT ===" +echo " http://localhost:8080/$WAR_NAME/api/health" + +case "$(uname -s)" in + CYGWIN*|MINGW*|MSYS*) + export CATALINA_HOME=$(cygpath -w "$TOMCAT") + export JAVA_HOME=$(cygpath -w "$JAVA_HOME_DIR") + exec cmd //c "$CATALINA_HOME\\bin\\catalina.bat" run + ;; + export CATALINA_HOME="$TOMCAT" + export JAVA_HOME="$JAVA_HOME_DIR" + exec "$TOMCAT/bin/catalina.sh" run + ;; +esac -- cgit v1.2.3