Hi have a multiproject where I want one of the libs to be in the tomcat lib folder (usually would be log4j or some other common lib). Code is available at github, the dependencies in the build files are:
regularLibA/build.gradle.kts
dependencies {
implementation("org.apache.commons:commons-text:1.10.0")
}
regularLibB/build.gradle.kts
dependencies {
implementation("org.apache.commons:commons-lang3:3.12.0")
implementation("org.apache.commons:commons-text:1.10.0")
}
tomcatLib/build.gradle.kts
dependencies {
implementation(project(":regularLibA"))
}
webApp/build.gradle.kts
dependencies {
implementation(project(":regularLibA"))
implementation(project(":regularLibB"))
implementation(project(":tomcatLib"))
}
The generated war file is:
webApp.war
βββ index.jsp
βββ WEB-INF
βββ classes
β βββ com
β βββ github
β βββ i23098
β βββ web
β βββ W.class
βββ lib
βββ commons-lang3-3.12.0.jar
βββ commons-text-1.10.0.jar
βββ regularLibA.jar
βββ regularLibB.jar
βββ tomcatLib.jar
How to configure gradle so that tomcatLib project is to be in the tomcat lib folder, so, the jar and itβs dependencies should not be added to the war file? i.e. the generated war file should be:
webApp.war
βββ index.jsp
βββ WEB-INF
βββ classes
β βββ com
β βββ github
β βββ i23098
β βββ web
β βββ W.class
βββ lib
βββ commons-lang3-3.12.0.jar
βββ regularLibB.jar
I tried changing the implementation(project(":tomcatLib"))
to providedCompile(project(":tomcatLib"))
in webApp/build.gradle.kts
but for some reason gradle doesnβt add commons-lang3-3.12.0.jar
in that case.
Also, how to create copy task of the files that are excluded from the war (tomcatLib.jar, regularLibA.jar and commons-text-1.10.0.jar) into the tomcat lib folder?