How to create zip file with maven: Java Client + JRE

922 Views Asked by At

I want to package a java client together with a runtime into one Zip-file.

How should I do this with maven?

Java Client:

package com.test.client;

public class Client {
    public static void main(String[] args) {
        System.out.println("Hello world!");
    }
}

This runs like:

java -cp "client.jar" com.test.Client

I want to deliver one zip-file with the jre: client.zip

/client.jar
/jre/
2

There are 2 best solutions below

0
On BEST ANSWER

Take a look at Apache Maven Assembly Plugin.

For datailed instructions, see here and here.

1
On

Have a look at the shade plugin https://maven.apache.org/plugins/maven-shade-plugin/. This supersedes the assembly plugin I believe.