I'm looking to copy dependency jars into the war file's WEB-INF/lib
directory whether they're transitive of the project or not. Is there a way to accomplish this?
My build.gradle
is below and I've tried multiple options. Is there a way to ensure that a specific set of jars appears in the war no matter what?
build.gradle
plugins {
id 'war'
}
war {
manifest { attributes("Class-Path": "resources/") }
version = null
}
//Does not contain the jackson libraries
providedCompile project(":components:Manager")
dependencies {
//Doesn't work
implementation libraries.jackson_core
implementation libraries.jackson_databind
implementation libraries.jackson_annotations
providedCompile(
//Doesn't work
libraries.jackson_core,
libraries.jackson_databind,
libraries.jackson_annotations,
///
libraries.mybatis,
libraries.mybatis_cdi,
libraries.javax_ejb,
libraries.javax_rs
)
compile "javax:javaee-api:$jeeVersion" //The only jar that appears in the WEB-INF/lib folder
//Doesn't work
compile(
libraries.jackson_core,
libraries.jackson_databind,
libraries.jackson_annotations,
)
}
Solved my problem by setting up a custom warLib
configuration
plugins {
id 'war'
}
configurations {
warLib
}
providedCompile project(":components:Manager")
dependencies {
providedCompile(
libraries.mybatis,
libraries.mybatis_cdi,
libraries.javax_ejb,
libraries.javax_rs
)
compile "javax:javaee-api:$jeeVersion"
warLib libraries.jackson_databind
}
war {
classpath configurations.warLib
manifest { attributes("Class-Path": "resources/") }
version = null
}