How to create executable java jar using maven and gradle

Published: 21 October 2021
on channel: Ashik's Tech Vlog
2,246
13

Executable jar using the command line:    • How to a create executable java jar file u...  

Maven:-
------------
add the following section in the pom.xml
N.B.: replace all () by xml tags
(dependencies)
(dependency)
(groupId)org.apache.maven.plugins(/groupId)
(artifactId)maven-assembly-plugin(/artifactId)
(version)2.3(/version)
(type)maven-plugin(/type)
(/dependency)
(/dependencies)
(build)
(plugins)
(plugin)
(artifactId)maven-assembly-plugin(/artifactId)
(configuration)
(archive)
(manifest)
(mainClass)demo.test.executable.Main(/mainClass)
(/manifest)
(/archive)
(descriptorRefs)
(descriptorRef)jar-with-dependencies(/descriptorRef)
(/descriptorRefs)
(/configuration)
(executions)
(execution)
(id)make-assembly(/id)
(phase)package(/phase) (!-- packaging phase --)
(goals)
(goal)single(/goal)
(/goals)
(/execution)
(/executions)
(/plugin)
(/plugins)
(/build)

Gradle:-
----------
add the following section in the build.gradle file

jar {
manifest {
attributes 'Main-Class': 'demo.test.executable.Main'
}
}


On this page of the site you can watch the video online How to create executable java jar using maven and gradle with a duration of hours minute second in good quality, which was uploaded by the user Ashik's Tech Vlog 21 October 2021, share the link with friends and acquaintances, this video has already been watched 2,246 times on youtube and it was liked by 13 viewers. Enjoy your viewing!