Chapter 11
The War Plugin

The war plugin in its current form does not do much. Expect it to grow over time. The war plugin extends the JavaPlugin. It disables the default jar archive generation of the Java Plugin and adds a default war archive task (myProjectName_war ). Here are the most important properties of the war archive task:




Convention to Property Mapping



Task Property Convention Property

Meaning




libConfiguration runtime

Adds all the libraries associated with specified configuration to the lib folder of the war archive.




additionalLibFileSets []

A list of FileSet container, specifying files to be put in the lib folder of the war archive.




classesFileSets [new FileSet(’build/classes’)]

A list of FileSet container, specifying files to be put in the classes folder of the war archive.




webInfFileSets [new FileSet(’src/main/webapp’)]

A list of FileSet container, specifying files to be put in the WEB-INF folder of the war archive.




webXml null

A file object pointing to an arbitrary file, which is copied to WEB-INF/web.xml location in the war archive. If this property is set, it has precedence over a web.xml file located in webInfFileSets




Have also a look at org.gradle.api.tasks.bundling.War.

If you want to enable the generation of the default jar archive additional to the war archive just type:

  myProjectName_jar.enabled = true