您可以使用into - > from語法。在耳塞包裝內建立一個梯子,你可以做到這一點 - 我提供了一個完整的例子。感興趣的代碼接近底部。
apply plugin: 'ear'
dependencies {
//this works great - war is in the ear.
deploy project(path: ':web', configuration: 'archives')
/*
The following dependencies will become ear libs and will
be placed in a dir configured via the libDirName property.
this works great as well.
*/
earlib group: 'log4j', name: 'log4j', version: '1.2.15', ext: 'jar'
}
ear {
// put dependent libraries into lib inside the generated EAR
libDirName 'lib'
deploymentDescriptor {
// JavaEE version (e.g. JavaEE 5 xsd)
version = "5"
//in app.ear/META-INF/application.xml<display-name>"
displayName = "My Application ear display display name""
//the xml entry in application.xml - doesn't make the jar itself part of the ear
module("ejbs.jar", "ejb")
//use into to define a folder within the ear and put stuff in it
into ('jars_direct'){
from('jar_project_1'){
include 'jar1.jar'
}
from('jar_project_2'){
include 'jar2.jar'
}
}
}
}