diff --git a/Dockerfile b/Dockerfile index 0006ead..1e5b279 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,10 @@ # install Linux https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository # Docker desktop https://docs.docker.com/desktop/install/ubuntu/ # https://hub.docker.com/_/tomcat/tags -FROM tomcat:9.0-jdk11-corretto-al2 +FROM tomcat:jdk17 +# FROM tomcat:9.0.85-jdk17-corretto-al2 +# FROM tomcat:9.0-jdk17-corretto-al2 # FROM tomcat:8.5.97-jdk17-corretto-al2 -# FROM tomcat:8.5.97-jdk11-corretto-al2 -# FROM tomcat:8.5.97-jdk8-corretto-al2 -# FROM tomcat:8-jdk8-corretto # https://hub.docker.com/layers/library/tomcat/7.0.109-jdk8-openjdk/images/sha256-489823486120d076cb576640c5819c6fa54948f470b46c54f02b48f462eb2c23 diff --git a/Dockerfile.wildfly b/Dockerfile.wildfly new file mode 100644 index 0000000..fcfdade --- /dev/null +++ b/Dockerfile.wildfly @@ -0,0 +1,16 @@ +# https://quay.io/repository/wildfly/wildfly?tab=tags +FROM quay.io/wildfly/wildfly:27.0.0.Final-jdk17 + +ARG APP_WAR_FILE_VERSION +ENV APP_WAR_FILE_VERSION=$APP_WAR_FILE_VERSION +ENV APP_WAR_FILE="Attendance" +ENV APP_WAR_FILE_PATH="build/libs/$APP_WAR_FILE-${APP_WAR_FILE_VERSION}" + +LABEL org.nz.itlatinos.image.authors="aleonrangel@outlook.co.nz" +LABEL maintainer="www.andres.nz" +LABEL war.version="$APP_WAR_FILE_VERSION" +LABEL docker.image.build.command="docker build --build-arg APP_WAR_FILE_VERSION=$version --tag aleon1220/attendance-webapp:$version --file Dockerfile.wildfly ." + +RUN printf "WAR version is $APP_WAR_FILE-$APP_WAR_FILE_VERSION" +RUN printf "Path to war file $APP_WAR_FILE_PATH" +ADD ${APP_WAR_FILE_PATH}.war /opt/jboss/wildfly/standalone/deployments/ \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 3f90bb2..93f300f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,13 +1,17 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent import java.net.InetAddress +group = "soa.nz.aut" +version = "0.7.8" +description = "Student Attendance WebApp" +// java.sourceCompatibility = JavaVersion.VERSION_17 + plugins { java // id ("com.adarshr.test-logger") version "3.0.0" // https://docs.gradle.org/7.3/dsl/org.gradle.api.tasks.bundling.War.html war id ("jacoco") - id("com.github.bjornvester.wsdl2java") version "2.0.2" } repositories { @@ -20,18 +24,25 @@ dependencies { // https://www.primefaces.org // https://primefaces.github.io/primefaces // https://mvnrepository.com/artifact/org.primefaces/primefaces - implementation("org.primefaces:primefaces:14.0.0-RC1") + // implementation("org.primefaces:primefaces:primefaces-14.0.0-RC1") + implementation("org.primefaces:primefaces:14.0.0-RC1:jakarta") // https://mvnrepository.com/artifact/org.primefaces.extensions/primefaces-extensions - implementation("org.primefaces.extensions:primefaces-extensions:14.0.0-RC1") - - // JSF runtime - // https://mvnrepository.com/artifact/org.apache.myfaces.core/myfaces-api - // implementation("org.apache.myfaces.core:myfaces-api:4.0.1") // API https://myfaces.apache.org - // implementation("org.apache.myfaces.core:myfaces-impl:4.0.1") // Faces Implementation - // implementation("org.apache.poi:poi:3.17") // apache POI DataExporter (Excel or XML) - // implementation("com.rometools:rome:1.9.0") // FeedReader + // implementation("org.primefaces.extensions:primefaces-extensions:14.0.0-RC1:jakarta") + // implementation(files("https://repo.maven.apache.org/maven2/org/primefaces/primefaces/14.0.0-RC1/primefaces-14.0.0-RC1-jakarta.jar")) + // implementation(files("https://repo.maven.apache.org/maven2/org/primefaces/extensions/primefaces-extensions/14.0.0-RC1/primefaces-extensions-14.0.0-RC1-jakarta.jar")) + // PrimeFaces Dependencies + // https://primefaces.github.io/primefaces/14_0_0/#/gettingstarted/dependencies + // https://mvnrepository.com/artifact/org.apache.myfaces.core/myfaces-api Apache myFaces + // implementation("org.apache.myfaces.core:myfaces-api:4.0.2") // API https://myfaces.apache.org + // implementation("org.apache.myfaces.core:myfaces-impl:4.0.2") + // https://mvnrepository.com/artifact/org.glassfish/jakarta.faces + implementation("org.glassfish:jakarta.faces:4.0.5") + // https://mvnrepository.com/artifact/org.apache.bval/bval-jsr + // implementation("org.apache.poi:poi:5.2.5") // apache POI DataExporter (Excel XML) + // implementation("com.rometools:rome:1.15.0") // FeedReader + // Apache Commons FileUpload 1.5 // implementation("net.sf.barcode4j:barcode4j-light:2.3.0") // barcode4j-light - // implementation("net.glxn.qrgen:qrgen:1.4") // qrgen QR Code support for Barcode + // implementation("net.glxn.qrgen:qrgen:1.8.0") // qrgen QR Code support for Barcode // implementation("com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:20220608.1") // Jakarta EE @@ -50,12 +61,12 @@ dependencies { // https://bitbucket.org/snakeyaml/snakeyaml/wiki/Documentation // https://mavenlibs.com/maven/dependency/org.yaml/snakeyaml implementation("org.yaml:snakeyaml:2.1") + // QRFunctions implementation("com.google.zxing:javase:3.5.1") implementation("com.google.zxing:core:3.5.1") - // dependency below only needed if using the Java 8 version of @Generated (through "jdk8") on Java 9 or later - // implementation("io.github.threeten-jaxb:threeten-jaxb-core:2.1.0") // Use Java Date/Time API. Clunky GregorianCalendar class - // TESTING + + // TEST // JUnit Jupiter API and Engine for unit testing testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2") testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.2") @@ -70,19 +81,15 @@ dependencies { implementation("com.kstruct:gethostname4j:1.0.0") } -group = "soa.nz.aut" -version = "0.7.7" -description = "Student Attendance WebApp" -// java.sourceCompatibility = JavaVersion.VERSION_17 - fun setWarVersion() { // function body project.version?.let { version -> println("WAR Version is $version") System.setProperty("APP_WAR_FILE_VERSION", version.toString()) - println("For local testing do \n APP_WAR_FILE_VERSION=" + version) - println("Append to the .env file with \n") - println("printf \"\$APP_WAR_FILE_VERSION \\n\" >> .env") + println("Local testing \n\n") + println("export APP_WAR_FILE_VERSION=" + version.toString()) + println("Using .env file \n\n") + println("printf export\"\$APP_WAR_FILE_VERSION \\n\" >> .env") } } @@ -111,7 +118,6 @@ fun getWarpackageVersion() { "home.xhtml", "index.xhtml" ) - // function body project.version?.let { version -> println("WAR Version is $version") println("Set env variable with") @@ -129,6 +135,12 @@ tasks.register("getProjectInfo") { getWarpackageVersion() } +tasks.register("getAppVersion") { + description = "Get current App version" + getAppVersion() +} + + tasks.war { archiveBaseName.set("Attendance") webAppDirectory.set(file("src/main/webapp")) @@ -137,6 +149,7 @@ tasks.war { // classpath(fileTree("additionalLibs")) // adds a file-set to the WEB-INF/lib dir. // classpath(moreLibs) // adds a configuration to the WEB-INF/lib dir. // webXml = file("src/someWeb.xml") // copies a file to WEB-INF/web.xml + doLast{ setWarVersion() } @@ -176,15 +189,3 @@ tasks.register("searchOpenLDAP") { includeTestsMatching("TestLDAPAuthentication.testOpenLDAPAdminSearch_withOpenLDAP") } } -// https://plugins.gradle.org/plugin/com.github.bjornvester.wsdl2java -// https://www.w3schools.com/xml/tempconvert.asmx?WSDL -wsdl2java { - // https://plugins.gradle.org/plugin/com.github.bjornvester.wsdl2java - bindingFile.set(layout.projectDirectory.file("src/main/bindings/bindings.xjb")) - - includes.set( - listOf( - "src/main/resources/wsdl/NumberConversion.wsdl" - ) - ) -} \ No newline at end of file diff --git a/maven/pom.xml b/maven/pom.xml index 6ff9cad..b5efb2e 100644 --- a/maven/pom.xml +++ b/maven/pom.xml @@ -132,7 +132,7 @@ 4.14 3.1.0 2.2.12 - 8.0 + 11.0 3.3 UTF-8 0.7.0 diff --git a/runme.sh b/runme.sh index 3cb523c..1456c58 100755 --- a/runme.sh +++ b/runme.sh @@ -27,21 +27,21 @@ version="$APP_WAR_FILE_VERSION" build() { gradle clean war --warn || true - docker build --build-arg APP_WAR_FILE_VERSION=$version --tag aleon1220/soa:$version . || true + docker build --build-arg APP_WAR_FILE_VERSION=$version --tag aleon1220/attendance-webapp:$version --file Dockerfile.wildfly . || true } run() { printf "Executing webapp Locally \n\n" || true - docker run --interactive --tty --detach --publish 8080:8080 --name $version aleon1220/soa:$version || true - printf "Executing Java Webapp version %s\n" $version + docker run --interactive --tty --detach --publish 8080:8080 --name $version aleon1220/attendance-webapp:$version || true + printf "Executing Java Webapp Attendance version %s\n" $version } clean() { - printf "Executing local CLEAN-UP\n\n" + printf "Executing local CLEAN-UP \n\n" gradle clean || true docker kill $version docker rm $version - docker image rm aleon1220/soa:$version + docker image rm aleon1220/attendance-webapp:$version printf "docker clean up completed \n\n" } diff --git a/src/main/webapp/02-attendance.xhtml b/src/main/webapp/02-attendance.xhtml index 7346011..bfb796f 100644 --- a/src/main/webapp/02-attendance.xhtml +++ b/src/main/webapp/02-attendance.xhtml @@ -2,11 +2,10 @@ - - + + Training Session Attendance @@ -14,43 +13,21 @@ - + -
- - - -
- - - -
+ + +
+ +
+
+ +
+ diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index 2ca3492..b28d8e3 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -1,27 +1,25 @@ - - + Class Attendance WebApp Faces Servlet - org.apache.myfaces.webapp.FacesServlet + jakarta.faces.webapp.FacesServlet 1 Faces Servlet *.xhtml - - org.apache.myfaces.webapp.StartupServletContextListener - index.xhtml + + 404 + /404-loginError.xhtml + \ No newline at end of file