使用Maven rpm插件排除目录内容 [英] Exclude contents of directory with maven rpm plugin

查看:124
本文介绍了使用Maven rpm插件排除目录内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建具有多个映射的pom文件.我试图将不同的功能组合到一个整齐的映射包中,但是在读取某些功能以及正确地传递权限方面遇到了一些麻烦.

I am creating a pom file with multiple mappings. I am trying to combine different functions into one neat package of mappings and I am having some trouble getting it to read some of the functions as well as pass permissions properly.

目录结构如下:

/conf
  /folder1
  /folder2
  /folder3
/bin

我可以使用以下设置来使bin正确映射:

I can get bin to map properly using the following setup:

<mapping>
   <directory>/opt/bin</directory>
   <filemode>755</filemode>
   <username>myUser</username>
   <groupname>myUser</groupname>
   <sources>
 <source>
   <location>bin</location>
 </source>
   <sources>
</mapping>

我要完成的是将所有conf放入具有相同权限的完全相同的结构/opt/conf中.但是我有一个程序集插件,它从folder2提取内容并将其压缩.我想跳过映射中folder2的内容,然后在解压缩后将zip文件包含在该文件夹中.所以我将拥有/opt/folder2/contents.zip

What I want to accomplish is to put all of conf into /opt/conf exactly the same structure with the same permissions. However I have an assembly plugin that takes contents from folder2 and zips them up. I want to skip the contents of folder2 in the mapping, and then include the zip file in the folder when it unwraps. So I will have /opt/folder2/contents.zip

这是我尝试的映射,但它们无法正确读取:

Here are my attempted mappings for that, but they are not reading properly:

<mapping>
<directory>/opt/conf</directory>
<filemode>755</filemode>
<username>myUser</username>
<groupname>myUser</groupname>
<sources>
    <source>
        <location>conf</location>
        <excludes>
            <exclude>folder2</exclude>
        </excludes>
    </source>
</sources>
 </mapping>
 <mapping>
<directory>/opt/conf/folder2</directory>
<filemode>755</filemode>
<username>myUser</username>
<groupname>myUser</groupname>
<sources>
    <source>
        <location>target</location>
        <includes>
           <include>*.zip</include>
        </includes>
    </source>
</sources>
</mapping>

推荐答案

正如我所见,您的pom文件应该可以工作,但是也许您不是从项目构建目录或其他文件夹中所需的文件中运行它,这意味着您需要在< location>中指定这些文件的相对路径.标签.

As I can see your pom file should works, but maybe you run it not from the project build directory or needed files located in another folder, which means that you need to specify a relative path to those files in <location> tag.

这篇关于使用Maven rpm插件排除目录内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆