Customizing the dependency
Whenever Gradle searches for dependencies in the repository, first it searches for a module descriptor file (for example, pom.xml
or ivy.xml
). Gradle parses this file and downloads the actual JAR file and its dependencies mentioned in the module descriptor. There might be a case when a module descriptor file is not present. In this case, Gradle directly looks for the JAR file and downloads it.
Gradle enables you to play with your dependencies in different ways. Not only you can download other file formats such as ZIP and WAR, you can also mention different classifiers, if needed.
Download file other than JAR
By default, Gradle downloads file with the .jar
extension. Sometimes, you might need to download either a ZIP file or a WAR file, which does not have any module descriptor. In this scenario, you can explicitly mention the extension of the file:
Dependencies {
runtime group: 'org.mywar', name: 'sampleWeb', version: '1.0', ext: 'war'
}