Creating executable jar in gradle

We can create an executable Jar by following below steps.
  • In build.gradle file, include jar task. In that task, provide the manifest information – main class that contains main method.
  • Then execute the jar task using gradle jar command
  • Above command will create the jar file in build/libs directory of the project
  • From the command line, execute java -jar jarfilename.jar
Below image shows how to specify manifest information in build.gradle file. Please note that app.C1 class contains main method.

Web development and Automation testing

solutions delivered!!