make JSTL and postgres (optionally) runtime dependencies again

Fri, 30 Dec 2022 13:21:09 +0100

author
Mike Becker <universe@uap-core.de>
date
Fri, 30 Dec 2022 13:21:09 +0100
changeset 262
c357c4e69b9e
parent 261
1467d182cfe3
child 263
aa22103809cd

make JSTL and postgres (optionally) runtime dependencies again

INSTALL file | annotate | diff | comparison | revisions
build.gradle.kts file | annotate | diff | comparison | revisions
     1.1 --- a/INSTALL	Thu Dec 29 15:12:25 2022 +0100
     1.2 +++ b/INSTALL	Fri Dec 30 13:21:09 2022 +0100
     1.3 @@ -26,10 +26,16 @@
     1.4  the lightpit_app user which has less privileges to create the data source and
     1.5  leave the lightpit_dbo user for the database operator.
     1.6  
     1.7 -4. Deploy the WAR file of lightpit
     1.8 +4. Build and Deploy the WAR file of lightpit
     1.9  
    1.10 -This is the most straight forward step. Just deploy the WAR file as you usually
    1.11 -do in your application server.
    1.12 +Build the WAR file with gradle. If your application server already provides
    1.13 +the necessary runtime libraries for JSTL and PostgreSQL, leave the variable
    1.14 +libsAreProvided = true during the build. Otherwise, set this variable to false
    1.15 +and the libraries will be included in the WAR file. But keep in mind that some
    1.16 +servlet containers, like Tomcat, are not so happy about this when hot redeploy-
    1.17 +ments are performed. If you experience ClassDefNotFound errors after a hot
    1.18 +redeployment, you should either provide the libs in your container or always
    1.19 +restart the entire container after a redeployment.
    1.20  
    1.21  5. Configuring a web server and authentication
    1.22  
     2.1 --- a/build.gradle.kts	Thu Dec 29 15:12:25 2022 +0100
     2.2 +++ b/build.gradle.kts	Fri Dec 30 13:21:09 2022 +0100
     2.3 @@ -25,14 +25,18 @@
     2.4      from("src/main/resources")
     2.5  }
     2.6  
     2.7 +val libsAreProvided = true
     2.8  kotlin {
     2.9      sourceSets {
    2.10          val main by getting {
    2.11              dependencies {
    2.12 -                // change the following to compileOnly, if you already have them on your server
    2.13 -                implementation("jakarta.servlet.jsp.jstl:jakarta.servlet.jsp.jstl-api:3.0.0")
    2.14 -                implementation("org.glassfish.web:jakarta.servlet.jsp.jstl:3.0.1")
    2.15 -                implementation("org.postgresql:postgresql:42.5.1")
    2.16 +                arrayOf(
    2.17 +                    "jakarta.servlet.jsp.jstl:jakarta.servlet.jsp.jstl-api:3.0.0",
    2.18 +                    "org.glassfish.web:jakarta.servlet.jsp.jstl:3.0.1",
    2.19 +                    "org.postgresql:postgresql:42.5.1"
    2.20 +                ).forEach {
    2.21 +                    if (libsAreProvided) compileOnly(it) else implementation(it)
    2.22 +                }
    2.23                  compileOnly("jakarta.servlet:jakarta.servlet-api:6.0.0")
    2.24                  val flexmarkVersion = "0.64.0"
    2.25                  implementation("com.vladsch.flexmark:flexmark:${flexmarkVersion}")

mercurial