Usage of apply plugin: 'application' tag in build.gradle file -


i starting explore gradle , question might naive. have noted gradle docs below plugin-

apply plugin: 'application' application plugin facilitates creating executable jvm application. makes easy start application locally during development. applying application plugin implicitly applies java plugin. 

i want understand if below plugin entry mandatory have not seen in many projects. if used make jar runnable/creating executable jvm application. mean skipping not make application executable ?

the 'application' plugin not mandatory when creating executable jvm application, facilitates creation of one.

you can use other plugins create runnable jar, 1 of them shadow plugin

if know how structure of runnable jar should like, can on own , pack needed libraries small apps or testing extending jar task java plugin.

jar { archivename = 'name.jar'  manifest {     attributes 'main-class': 'main',             'class-path': configurations.runtime.files.collect { "lib/$it.name" }.join(' '),             'implementation-version': project.version (if any) }  from(configurations.compile.collect { it.isdirectory() ? : ziptree(it) }) } 

i suggest using application plugin. supported, gradle, it's recommended other developers.

applying application plugin implicitly applies java plugin. main source set “application”. , facilitates creation of runnable jar application.

the java plugin adds java compilation along testing , bundling capabilities project. serves basis many of other gradle plugins.


to answer question:

application plugin 1 (recommended) of ways runnable jvm app creation.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -