I want to create empty directory structure while doing the packaging using maven-assembly-plugin. I am successful in including all the files, but not creating the empty ones,
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)
The below one is my assembly file,
<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>
So, I tried the simple "directory" tag as recommended in one of the blog, but no luck.
Could any one help me please?
You can use a thing like this here:
Note that @khmarbaise's answer will not exclude all subfolders, you need to use a stronger wildcard:
Found at How do I include an empty directory in a maven assembly?