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?