我正在使用Gradle-ospackage RPM Plugin
编写一个gradle代码来生成RPM。我能够生成RPM。我的要求是,在生成RPM时,应将特定文件移动到不同的位置。例如,我有以下结构,
|--SOURCES
--Properties
--a.property
--b.property
--c.property
--configs
--conf.xml
--cache.xml
--war
--test.war
--testng.java
--val.java
...
...
|--SPECS
|--RPMS
|--SRPMS
在上面的例子中,当生成rpm时,*.properties
,*.war
和conf.xml
应该移动到其他路径,如/modules/properties/
,/modules/binaries/
和/modules/conf/
。
提前致谢!
nebula-ospackage
plugin使用Gradle Copy Spec
功能,它允许您使用from
和into
子句配置源目录结构和目标rpm内容布局之间的“映射”。您可以在插件文档here和here中找到几个示例。
在您的示例中,您可以使用下面的内容
ospackage{
// (...)
into("/modules"){
into ("properties"){
from ("/SOURCES/Properties") // you could add some filtering
}
into ("binaries"){
from ("/SOURCES/war")
}
into ("conf"){
from ("/SOURCES/configs")
}
// EDIT : include all .java source files
into ("sources"){
from ("/SOURCES") {
include "**/*.java"
}
}
}
}