Search code examples
javamavenmaven-assembly-plugin

Running Jar file created using Maven in client side


I created Fat jar using Maven Assembly Plugin, I am able to run jar file using

java -jar filename.jar

My questions are

  1. Does client need to have Maven installed in his system to run this jar?
  2. Do Java versions need to be same in both machines i.e while creating jar (Development Environment) and Client Side (Production Environment)

Solution

    1. No, client needs JRE only
    2. Required JRE version is controlled by properties in pom.xml
    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.5</maven.compiler.target>
    </properties>
    

    This example means "sources has constructions from Java 8" and "code will be generated for Java 5 or higher"