From 761eb6f4a6df45b48570796265ad9a30d5d73e83 Mon Sep 17 00:00:00 2001 From: 0qln <0qln@proton.me> Date: Sat, 22 Nov 2025 12:42:42 +0100 Subject: [PATCH] working jetty config --- .envrc | 1 - .gitignore | 3 ++ build.xml | 0 flake.lock | 2 +- flake.nix | 42 +++++++++++++--- pom.xml | 84 +++++++++++++++++++------------ src/main/webapp/WEB-INF/beans.xml | 6 +++ src/main/webapp/WEB-INF/web.xml | 9 +++- 8 files changed, 106 insertions(+), 41 deletions(-) delete mode 100644 .envrc delete mode 100644 build.xml create mode 100644 src/main/webapp/WEB-INF/beans.xml diff --git a/.envrc b/.envrc deleted file mode 100644 index 3550a30..0000000 --- a/.envrc +++ /dev/null @@ -1 +0,0 @@ -use flake diff --git a/.gitignore b/.gitignore index 4a13688..52675fc 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,6 @@ build/ ### nix / direnv .direnv result + +### jetty +.jetty/home diff --git a/build.xml b/build.xml deleted file mode 100644 index e69de29..0000000 diff --git a/flake.lock b/flake.lock index f82f111..8ba051b 100644 --- a/flake.lock +++ b/flake.lock @@ -29,8 +29,8 @@ }, "original": { "owner": "NixOS", - "ref": "nixos-unstable", "repo": "nixpkgs", + "rev": "9da7f1cf7f8a6e2a7cb3001b048546c92a8258b4", "type": "github" } }, diff --git a/flake.nix b/flake.nix index 6a927be..25d97a9 100644 --- a/flake.nix +++ b/flake.nix @@ -3,10 +3,14 @@ inputs = { flake-parts.url = "github:hercules-ci/flake-parts"; - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + nixpkgs.url = "github:NixOS/nixpkgs/9da7f1cf7f8a6e2a7cb3001b048546c92a8258b4"; }; - outputs = inputs @ {flake-parts, ...}: + outputs = inputs @ { + flake-parts, + self, + ... + }: flake-parts.lib.mkFlake {inherit inputs;} { imports = []; systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"]; @@ -95,14 +99,38 @@ mermaid-cli openjdk jetty - ant + maven ] ++ latexPackages; - shellHook = '' - echo "Usage Example:" - echo "jetty ..." - ''; + shellHook = + # bash + '' + # jetty docs: https://jetty.org/docs/jetty/12.1/operations-guide/begin/index.html + export JETTY_HOME="$(readlink -f .)/.jetty/home" + export JETTY_BASE="$(readlink -f .)/.jetty/base" + + mkdir -p "$JETTY_HOME" "$JETTY_BASE" + for item in ${pkgs.jetty}/*; do + ln -sf "$item" "$JETTY_HOME/" + done + + jetty() { + mkdir -p $JETTY_BASE/webapps/ + ln -fs "$(readlink -f target/*.war)" $JETTY_BASE/webapps/ + + java \ + -Djetty.home="$JETTY_HOME" \ + -Djetty.base="$JETTY_BASE" \ + -jar $JETTY_HOME/start.jar $@ + } + + jetty --add-modules=http,ee11-cdi,ee11-ext,ee11-deploy,ee11-environment,ee11-annotations,ee11-glassfish-jstl,ee11-jndi,ee11-jsp,ee11-jstl,ee11-plus,ee11-security,ee11-servlet,ee11-servlets,ee11-webapp,ee11-websocket-jakarta,ee11-websocket-jetty,ee11-websocket-jetty-client-webapp + + echo "Usage Example:" + echo "jetty --add-modules=... # add modules" + echo "jetty # run webserver" + ''; }; }; flake = { diff --git a/pom.xml b/pom.xml index 1e7a292..fb0fcb4 100755 --- a/pom.xml +++ b/pom.xml @@ -12,48 +12,70 @@ UTF-8 - 8 - 8 + UTF-8 + 21 5.11.0-M2 + 3.13.0 + 3.4.0 - - jakarta.platform - jakarta.jakartaee-web-api - 11.0.0-M3 - provided - - org.jboss.weld.se - weld-se-core - 6.0.0.Beta1 + + jakarta.platform + jakarta.jakartaee-web-api + 11.0.0 + provided - + + + org.glassfish + jakarta.faces + 4.1.3 + + + + jakarta.enterprise + jakarta.enterprise.cdi-api + 4.1.0 + + + jakarta.enterprise + jakarta.enterprise.cdi-el-api + 4.1.0 + + + + org.jboss.weld.servlet + weld-servlet-core + 5.1.2.Final + + + org.junit.jupiter junit-jupiter-api ${junit.version} - test - - org.junit.jupiter - junit-jupiter-engine - ${junit.version} - test - - - org.projectlombok - lombok - RELEASE - provided - + + + org.projectlombok + lombok + 1.18.30 + + demo - - org.apache.maven.plugins - maven-war-plugin - 3.4.0 - + + org.apache.maven.plugins + maven-compiler-plugin + ${compiler-plugin.version} + + + org.apache.maven.plugins + maven-war-plugin + ${war-plugin.version} + + - \ No newline at end of file + diff --git a/src/main/webapp/WEB-INF/beans.xml b/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 0000000..26dc70a --- /dev/null +++ b/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,6 @@ + + + diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index e94a73e..cb1c621 100755 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -3,13 +3,20 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd" version="6.0"> + + + jakarta.faces.CONFIG_FILES + /WEB-INF/faces-config.xml + + Faces Servlet jakarta.faces.webapp.FacesServlet 1 + Faces Servlet *.xhtml - \ No newline at end of file +