使用gradle中的rpm插件生成RPM时各种目标的各种文件

问题描述 投票:0回答:1

我正在使用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*.warconf.xml应该移动到其他路径,如/modules/properties//modules/binaries//modules/conf/

提前致谢!

gradle rpm
1个回答
1
投票

nebula-ospackageplugin使用Gradle Copy Spec功能,它允许您使用frominto子句配置源目录结构和目标rpm内容布局之间的“映射”。您可以在插件文档herehere中找到几个示例。

在您的示例中,您可以使用下面的内容

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"
            }
        }
    } 
}
© www.soinside.com 2019 - 2024. All rights reserved.