We've had a need from time-to-time to upgrade the embedded Tomcat
separately and a kind soul helped us so I'll share what he showed us.  Just
setting tomcat.version in gradle.properties will not work.  You can modify
your build.gradle as follows:

configurations.all {
resolutionStrategy {
cacheChangingModulesFor 0, "seconds"
// etc
// Override from base CAS to use tomcatVersion
eachDependency { DependencyResolveDetails dependency ->
def requested = dependency.requested
if (requested.group.startsWith("org.apache.tomcat")) {
// println "Using tomcat version ${tomcatVersion} for ${requested.group}:${
requested.name}"
dependency.useVersion("${tomcatVersion}")
}
}
}
exclude(group: "cglib", module: "cglib")
// etc
}

Then within the dependencies block where you would add various bits of CAS
functionality:

/**
* CAS dependencies and modules may be listed here.
*
* There is no need to specify the version number for each dependency
* since versions are all resolved and controlled by the dependency
management
* plugin via the CAS bom.
**/
implementation "org.apereo.cas:cas-server-support-whatever"
// etc

// Override from base CAS to use specified tomcatVersion
implementation "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}"
implementation "org.apache.tomcat.embed:tomcat-embed-el:${tomcatVersion}"
implementation "org.apache.tomcat:tomcat-catalina-ha:${tomcatVersion}"

And finally within the buildscript block at the end something like this to
remove the version of tomcat that the upstream based CAS project is using:

overlays {
/*
https://docs.freefair.io/gradle-plugins/current/reference/#_io_freefair_war_overlay
Note: The "excludes" property is only for files in the war dependency.
If a jar is excluded from the war, it could be brought back into the final
war as a dependency
of non-war dependencies. Those should be excluded via normal gradle
dependency exclusions.
*/
cas {
from "org.apereo.cas:cas-server-webapp${project.appServer}:${
project.'cas.version'}@war"

provided = false
// Exclude base CAS tomcat jars
excludes = ["WEB-INF/lib/servlet-api-2*.jar", "WEB-INF/lib/tomcat-*.jar"]
}
}

On Thu, Oct 19, 2023 at 3:39 AM Mohamed Amdouni <me.amdo...@gmail.com>
wrote:

> Hello,
>
> When using cas version 6.6.12 for example the embedded tomcat server is
> 9.0.80.
> What is the best way to upgrade only the tomcat server to 9.0.81.
>
> For spring boot application with maven it required only to set the
> tomcat.version pom properties.
>
> Best regards,
>
> --
> - Website: https://apereo.github.io/cas
> - Gitter Chatroom: https://gitter.im/apereo/cas
> - List Guidelines: https://goo.gl/1VRrw7
> - Contributions: https://goo.gl/mh7qDG
> ---
> You received this message because you are subscribed to the Google Groups
> "CAS Community" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cas-user+unsubscr...@apereo.org.
> To view this discussion on the web visit
> https://groups.google.com/a/apereo.org/d/msgid/cas-user/CALmwvcZLU41mQpPub942gXmca2t%3D7eoQau_oPDvKZGaqQNOEiQ%40mail.gmail.com
> <https://groups.google.com/a/apereo.org/d/msgid/cas-user/CALmwvcZLU41mQpPub942gXmca2t%3D7eoQau_oPDvKZGaqQNOEiQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Jonathon Taylor (he/him)
Information Security Office
jonath...@berkeley.edu

-- 
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
--- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cas-user+unsubscr...@apereo.org.
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/CABzqDo_3gL8PZsuHrnu2XXZ4OjOzf%3DA%2BM7XKhEj6jj-XCvCvrw%40mail.gmail.com.

Reply via email to