diff --git a/app/src/main/resources/common/gradle/build.gradle.mustache b/app/src/main/resources/common/gradle/build.gradle.mustache index fbdb9865..2a26498a 100644 --- a/app/src/main/resources/common/gradle/build.gradle.mustache +++ b/app/src/main/resources/common/gradle/build.gradle.mustache @@ -148,6 +148,15 @@ configurations { if (failIfConflict) { failOnVersionConflict() } + + if (project.hasProperty("tomcatVersion")) { + eachDependency { DependencyResolveDetails dependency -> + def requested = dependency.requested + if (requested.group.startsWith("org.apache.tomcat") && requested.name != "jakartaee-migration") { + dependency.useVersion("${tomcatVersion}") + } + } + } } exclude(group: "cglib", module: "cglib") exclude(group: "cglib", module: "cglib-full") @@ -463,6 +472,10 @@ dependencies { implementation "org.apereo.cas:cas-server-core-api-configuration-model" implementation "org.apereo.cas:cas-server-webapp-init" + if (project.hasProperty("appServer")) { + implementation "org.apereo.cas:cas-server-webapp-init${project.appServer}" + } + developmentOnly "org.springframework.boot:spring-boot-devtools:${project.springBootVersion}" {{/nativeImageSupported}} {{/casServer}} diff --git a/app/src/main/resources/common/gradle/gradle.properties.mustache b/app/src/main/resources/common/gradle/gradle.properties.mustache index c8b1c670..e4c3c803 100644 --- a/app/src/main/resources/common/gradle/gradle.properties.mustache +++ b/app/src/main/resources/common/gradle/gradle.properties.mustache @@ -60,6 +60,14 @@ gradleGraalVmNativePluginVersion=@gradleGraalVmNativePluginVersion@ # and want to set up, download and manage the container (i.e. Apache Tomcat) yourself. appServer={{appServer}} +# If you are using an embedded Apache Tomcat container to deploy and run CAS, +# and need to override the Apache Tomcat version, uncomment the property below +# and specify the the Apache Tomcat version, i.e. {{tomcatVersion}}. +# While enabled, this will override any and all upstream changes to +# Apache Tomcat dependency management and you will be directly responsible to make +# adjustments and upgrades as necessary. Use with caution, favor less work. +# tomcatVersion={{tomcatVersion}} + # Settings to generate keystore # used by the build to assist with creating # self-signed certificates for https endpoints @@ -78,8 +86,6 @@ gradleOpenRewritePluginVersion=@gradleOpenRewritePluginVersion@ {{/openRewriteSupported}} {{/casServer}} -tomcatVersion={{tomcatVersion}} - # Include private repository # override these in user properties or pass in values from env on command line privateRepoUrl= diff --git a/app/src/main/resources/common/gradle/springboot.gradle.mustache b/app/src/main/resources/common/gradle/springboot.gradle.mustache index c5b2729e..fea67232 100644 --- a/app/src/main/resources/common/gradle/springboot.gradle.mustache +++ b/app/src/main/resources/common/gradle/springboot.gradle.mustache @@ -143,7 +143,12 @@ if (!nativeImage) { {{/configServer}} provided = false - excludes = ["WEB-INF/lib/servlet-api-2*.jar"] + + def excludeArtifacts = ["WEB-INF/lib/servlet-api-2*.jar"] + if (project.hasProperty("tomcatVersion")) { + excludes += ["WEB-INF/lib/tomcat-*.jar"] + } + excludes = excludeArtifacts /* excludes = ["WEB-INF/lib/somejar-1.0*"] diff --git a/app/src/main/resources/common/gradle/tasks.gradle.mustache b/app/src/main/resources/common/gradle/tasks.gradle.mustache index 7e15c665..5aaa65b7 100644 --- a/app/src/main/resources/common/gradle/tasks.gradle.mustache +++ b/app/src/main/resources/common/gradle/tasks.gradle.mustache @@ -203,9 +203,6 @@ task copyCasConfiguration(type: Copy, group: "CAS", {{#casServer}} -def tomcatDirectory = "${buildDir}/apache-tomcat-${tomcatVersion}" -project.ext."tomcatDirectory" = tomcatDirectory - def explodedDir = "${buildDir}/app" def explodedResourcesDir = "${buildDir}/cas-resources" diff --git a/app/src/main/resources/overlay/openrewrite/CASUpgrade.yml.mustache b/app/src/main/resources/overlay/openrewrite/CASUpgrade.yml.mustache index e70b8de1..9fc33fb7 100644 --- a/app/src/main/resources/overlay/openrewrite/CASUpgrade.yml.mustache +++ b/app/src/main/resources/overlay/openrewrite/CASUpgrade.yml.mustache @@ -35,9 +35,4 @@ recipeList: key: jibVersion value: {{jibVersion}} overwrite: true - filePattern: 'gradle.properties' - - org.openrewrite.gradle.AddProperty: - key: tomcatVersion - value: {{tomcatVersion}} - overwrite: true - filePattern: 'gradle.properties' + filePattern: 'gradle.properties' \ No newline at end of file