我想在使用maven-assembly-plugin进行打包时创建空目录结构。我成功地包含了所有文件,但没有创建空文件,
opt/SP/myprod/bin/* (contains files)
opt/SP/myprod/lib/* (contains files)
opt/SP/myprod/conf/* (contains files)
var/SP/myprod/run (Empty directories)
var/SP/myprod/log (Empty directories)
var/SP/myprod/tmp (Empty directories)
下面是我的汇编文件,
<id>stage</id>
<formats>
<format>tar.gz</format>
<format>zip</format>
</formats>
<fileSets filtered="true" encoding="UTF-8">
<fileSet>
<directory>${run.dir}</directory>
<fileMode>755</fileMode>
</fileSet>
<fileSet>
<directory>${tmp.dir}</directory>
<fileMode>755</fileMode>
</fileSet>
<fileSet>
<directory>${log.dir}</directory>
<fileMode>755</fileMode>
</fileSet>
<fileSet>
<directory>${basedir}/config</directory>
<outputDirectory>${install.dir}/config</outputDirectory>
<fileMode>755</fileMode>
</fileSet>
<fileSet>
<directory>${basedir}/bin</directory>
<outputDirectory>${install.dir}/bin</outputDirectory>
<fileMode>755</fileMode>
</fileSet>
<fileSet>
<directory>${basedir}/images</directory>
<outputDirectory>${install.dir}/images</outputDirectory>
<fileMode>755</fileMode>
</fileSet>
<fileSet>
<directory>${basedir}/package-scripts</directory>
<outputDirectory>${install.dir}/package-scripts</outputDirectory>
<fileMode>755</fileMode>
</fileSet>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>${install.dir}/lib</outputDirectory>
<includes>
<include>myfile.jar</include>
</includes>
<fileMode>755</fileMode>
</fileSet>
<fileSet>
<directory>${project.build.directory}/lib</directory>
<outputDirectory>${install.dir}/lib</outputDirectory>
<fileMode>755</fileMode>
</fileSet>
</fileSets>
所以,我尝试了其中一个博客推荐的简单“目录”标签,但没有运气。
有人可以帮助我吗?
答案 0 :(得分:4)
你可以在这里使用这样的东西:
<fileSets>
<fileSet>
<outputDirectory>/an-other-empty-folder</outputDirectory>
<directory>${project.basedir}/target</directory>
<excludes>
<exclude>*</exclude>
</excludes>
</fileSet>
</fileSets>
答案 1 :(得分:4)
请注意,@ khmarbaise的答案不会排除所有子文件夹,您需要使用更强的通配符:
<fileSets>
<fileSet> <!-- Create empty directory -->
<outputDirectory>coredumps</outputDirectory>
<excludes><exclude>**/*</exclude></excludes>
</fileSet>
</fileSets>