Issue
I am writing a gradle code using Gradle-ospackage RPM Plugin
to generate RPM. I am able to generate RPM. My requirement is that, while generating the RPM, specific files should be moved to different location.
For Example I have below structure,
|--SOURCES
--Properties
--a.property
--b.property
--c.property
--configs
--conf.xml
--cache.xml
--war
--test.war
--testng.java
--val.java
...
...
|--SPECS
|--RPMS
|--SRPMS
In the above example, when generating rpm, *.properties
,*.war
and conf.xml
should be moved to some other path like /modules/properties/
,/modules/binaries/
and /modules/conf/
.
Thanks in advance!
Solution
The nebula-ospackage
plugin makes use of Gradle Copy Spec
feature, which allows you to configure the "mappings" between sources directory structure and target rpm content layout, using from
and into
clauses. You can find several examples in the plugin documentation here and here.
In you example, you could have something like below
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"
}
}
}
}
Answered By - M.Ricciuti