Gradle compile and providedCompile Example

By Arvind Rai, September 23, 2014

In this page we will see how to use gradle compile and providedCompile in our gradle script. compile configuration downloads the JAR dependency and its transitive dependency. All the JAR dependency will be collected in archive if using WAR plugin. providedCompile is also a configuration in gradle script, which enables any JAR and its transitive dependency not to go in WAR archive but be available at compile time. Find the Sample Example

Compile configuration will add abobe jar its tarsitive dependency with the version provided.
If we are using only JAR plugin, then the JAR and its transitive dependency JAR will be available at compile time and if we are using WAR plugin, then those JAR will also be added in WAR file.

Gradle providedCompile

There are some cases when we do not want to archive some JAR in WAR file. To achieve this we use providedCompile . providedCompile is used as below.