How to add files to META-INF with Maven

Suppose you need to add some_dir/your_file.txt to META-INF using Maven, so that the final path looks like this:

your_app.jar/META-INF/some_dir/your_file.txt

To do this, you need to create a META-INF/some_dir folders in the src/main/resources directory, and put there your_file.txt file:

src/
  main/
    resources/
      META-INF/
        some_dir/
          your_file.txt

Once compiled, Maven will move META-INF/some_dir/your_file.txt from resources to the right place without deleting the existing files in META-INF inside your jar.

If you still have any questions, feel free to ask me in the comments under this article, or write me on promark33@gmail.com.

If I saved your day, you can support me :)

Leave a Reply

Your email address will not be published.