Gradle: how to exclude jar from an ear file? -
i have question regarding excluding jar file ear artifact. project has following modules:
project - ejb_module - war_module - ear_module - other_module
in ear_module/build.gradle
:
dependencies { deploy project(ejb_module) earlib project(ejb_module) deploy project(war_module) earlib project(war_module) }
the problem how exclude jar artifact produced war_module
.
the war_module
produces both war , jar artifact. reason need jar artifact other_module
depends on it.
a complicated factor war_module
has dependencies needs go via earlib
.
so question how exclude war_module.jar
ear file? included both @ root , in app-inf/lib
.
i presume in war_module
applying both war
, java
plugins .war.
, .jar
artifacts ?
try:
deploy project(path: 'war_module', configuration: 'archives') earlib project(path: 'war_module', configuration: 'archives')
it should pick .war
because if gradle war plugin code can see overrides default output of project, if java plugin included.
additionally, war plugin uses java plugin compile code under hood.
you, of course, can exclude artefact build using
config (project){exclude module: 'name'}
but think not best can here.
try looking providedruntime
, runtimeonly
configurations depending on version of gradle use.
if artefact used compilation compileonly
etc.
this configuration used in dependecies{}
use jar not going expose anywhere else should not land in artefact build , fit in case, question wasn't asking it's advice.
Comments
Post a Comment