Exclude contents of directory with maven rpm plugin

别等时光非礼了梦想. 提交于 2019-12-07 19:54:22

问题


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.

The directory structure is as follows:

/conf
  /folder1
  /folder2
  /folder3
/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>

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>

回答1:


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.



来源:https://stackoverflow.com/questions/22230264/exclude-contents-of-directory-with-maven-rpm-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!