我希望将文件夹移动到我生成的耳朵的根部。
我的子项目中的build.gradle如下所示:
apply plugin: 'ear'
dependencies {
deploy project(path: ':UiWeb', configuration:'archives')
deploy project(path: ':ProviderWeb', configuration:'archives')
deploy project(path: ':Business', configuration: 'archives')
deploy project(path: ':Common', configuration: 'archives')
deploy project(path: ':Domain', configuration: 'archives')
deploy project(path: ':Translator', configuration: 'archives')
deploy project(path: ':Properties', configuration: 'archives')
earlib fileTree(dir: 'sharedLib', include: '*.jar')
earlib fileTree(dir: 'lib', include: '*.jar')
}
ear {
from("EAR/resources/properties/${environment}") {
include "*.*"
into "properties"
}
classifier environment()
libDirName 'lib'
deploymentDescriptor {
applicationName = "app"
displayName = 'EAR'
description = 'app'
version = '6'
metaInf {
from './META-INF'
exclude 'application.xml'
}
webModule("UiWeb.war", "UiWeb")
securityRole 'AllUsers'
}
manifest {
attributes("Implementation-Title": "App",
"Implementation-Version": "TEST",
"Implementation-Vendor": "Company",
"Build-By": "gradle",
"Build-Date": new Date().toString());
}
}
我的麻烦是from("EAR/resources/properties/${environment}")
,因为它实际上并没有将文件夹复制到耳中!我在任何级别的控制台输出中都没有出现任何错误。
使用-Penvironment = xxx将${environment}
传递给Gradle,我知道这是有效的,因为该值会附加到耳朵名称。
拜托,有人可以帮我吗?
答案 0 :(得分:0)
如果您通过属性传递environment
的值,那么您应该使用project.getProperties().get("environment")
试试这个:
from("EAR/resources/properties/${project.getProperties().get("environment")}") {
include "*.*"
into "properties"
}
不要忘记在项目environment=
gradle.properties