I think that was a mistake on my part.  We actually have that third section
embedded in a stand-alone bootWar block and NOT within the buildscript
block.  Here's what that definition looks like in full:

bootWar {
def executable = project.hasProperty("executable") && Boolean.
valueOf(project.getProperty("executable"))
if (executable) {
logger.info "Including launch script for executable WAR artifact"
launchScript()
} else {
logger.info "WAR artifact is not marked as an executable"
}

archiveName "cas.war"
baseName "cas"

entryCompression = ZipEntryCompression.STORED

/*
attachClasses = true
classesClassifier = 'classes'
archiveClasses = true
*/

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"]
/*
excludes = ["WEB-INF/lib/somejar-1.0*"]
enableCompilation = true
includes = ["*.xyz"]
targetPath = "sub-path/bar"
skip = false
*/
}
}
}

On Sat, Nov 4, 2023 at 9:31 AM Doug C <wdouglascampb...@gmail.com> wrote:

> I attempted this method to update to Tomcat 9.0.82.  The first two
> sections of your instructions work for me but when I attempt to remove the
> version of Tomcat that CAS is using upstream using the third section of
> your instructions, I receive the following error:
>
> FAILURE: Build failed with an exception.
>
> * Where:
> Build file '/cas-overlay/build.gradle' line: 43
>
> * What went wrong:
> A problem occurred evaluating root project 'cas'.
> > Could not find method overlays() for arguments
> [build_ep14vlqtz5elu1r5h6m9cwzsu$_run_closure1$_closure4@43ae0bb2] on
> object of type org.gradle.api.internal.initialization.DefaultScriptHandler.
>
> I'm not sure what I am missing.  Any thoughts?
>
> Thanks!
>
> On Thursday, October 19, 2023 at 4:30:28 PM UTC-4 Jonathon Taylor wrote:
>
> 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.am...@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+u...@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
> jona...@berkeley.edu
>
>

-- 
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-%3DXGZQaJ0CtGQRPytfTL5x6BLpozc-_JFLk%2Bd%2Bfrbsmw%40mail.gmail.com.

Reply via email to