Maven – Generate a package with external resources

Maven – How to generate a package with external resources

While making a java batch, it’s a common way to generate a working directory structure like the following:

The directories above will contain:

  • conf – external configuration properties
  • lib – the jar libraries, comprensive of the main jar
  • logs – the log files
  • bin – the sh / bat script file within the instructions to run the batch properly

Our source structure folder will be similar:

  • applconf – external configuration properties
  • scripts – the sh / bat script file within the instructions to run the batch properly
  • logs – the log files

Now it’s time to edit pom.xml properly.


The following lines will copy applconf content inside target conf directory

The following lines copy scripts file inside bin directory

The following copy main jar with dependencies inside lib directory:

The following will generate manifest.inf within the main jar package

Finally, the pom.xml declare that directive to build the zipped package are contained inside assembly-app.xml file


These directives will copy jar dependencies inside lib directory and applconf content inside conf directory.

If our need is to place main jar outside lib directory, copy the following lines instead:


Be the first to comment

Leave a Reply

Your email address will not be published.

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    Markdown is turned off in code blocks:
     [This is not a link](

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see