1

I see how to create an empty directory in Maven from

Can I create empty directories while packaging using maven-assembly-plugin?

But how do you create an empty file in Maven? I need it to work around this Amazon Elastic Beanstalk bug.

AWS Elastic Beanstalk Tomcat works with .war but not .zip

I'm expecting something like

<touch>target/empty.war</touch>

I tried

  <files>
    <file>
      <source>NUL</source>    <!-- Since it's on Windows -->
      <outputDirectory/>
      <destName>empty.war</destName>

And

  <files>
    <file>
      <source/>
      <outputDirectory/>
      <destName>empty.war</destName>

But the latter attempt creates an empty.war/ directory instead of a file! Despite the documentation:

http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html#class_file

destName String Sets the destination filename in the outputDirectory. Default is the same name as the source's file.

Chloe
  • 25,162
  • 40
  • 190
  • 357

1 Answers1

0

I added an empty empty.war file to the root of the project and checked it into source control. Then I added the file to the ZIP. This isn't an intuitive way of doing it, but I could find no other.

  <files>
    <file>
      <source>empty.war</source>
      <outputDirectory/>
Aswan
  • 66
  • 10
Chloe
  • 25,162
  • 40
  • 190
  • 357