简体   繁体   English

maven-assembly-plugin如何过滤掉整个目录?

[英]How does maven-assembly-plugin filter out whole directories?

My distribution file is like below. 我的分发文件如下所示。 I want create a public and logs folder under my project root folder (${basedir}) and package them to a zip file. 我想在项目根文件夹($ {basedir})下创建一个public and logs文件夹,并将其打包为一个zip文件。 Now, my problem is that all files (for example, 1.log, 2.log) under public and logs folders are not packaged into zip file, but all directories under public and logs folders are packaged into the zip file. 现在,我的问题是publiclogs文件夹下的所有文件(例如1.log,2.log) 都没有打包到zip文件中,而publiclogs文件夹下的所有目录都打包到了zip文件中。

How to filter out the directories too? 如何也过滤掉目录? I just want to create a empty pubic and logs folder in my zip file. 我只想在我的zip文件中创建一个空的 pubic和logs文件夹。

   <fileSets>
        <fileSet>
            <directory>${basedir}\src\main\bin</directory>
            <outputDirectory>\bin</outputDirectory>
            <includes>
                <include>*.sh</include>
                <include>*.bat</include>
            </includes>
        </fileSet>
        <fileSet>
            <directory>${basedir}\logs</directory>
            <excludes>
                <exclude>**/*.*</exclude>
            </excludes>
            <outputDirectory>\logs</outputDirectory>
        </fileSet>
        <fileSet>
            <directory>${basedir}\public\</directory>
            <excludes>
                <exclude>**/*.*</exclude>
            </excludes>
            <outputDirectory>\public</outputDirectory>
        </fileSet>
    </fileSets>

The regular expression you provided: 您提供的正则表达式:

<exclude>**/*.*</exclude>

will only match files in the directory that have format XY That is, each one must include a '.' 仅匹配目录中格式为XY的文件。也就是说,每个文件都必须包含“。”。 and have an extension. 并进行扩展。 Presumably the subdirectories do not have this format. 大概子目录没有这种格式。 So, add another line to each section: 因此,在每个部分添加另一行:

<exclude>**/*</exclude>

I think that will do it. 我认为这可以做到。 The Ant directory task documentation includes some helpful examples. Ant目录任务文档包含一些有用的示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM