What's the difference between implementation and compile in Gradle Build? | Technical, Finance, Investment Questions

What's the difference between implementation and compile in Gradle Build?

Mahak Chahal

8 months ago

When we are building and running a Java project there are two classpaths involved:


  1. Compile classpath : It contains list of dependencies that are required for the JDK to be able to compile Java code into .class files.
  2. Runtime classpath : It contains list of dependencies is required to actually run the compiled Java code.


When we configure Gradle dependencies all we really doing is configuring which dependencies should appear on which classpath. 


Given there are only two classpaths, Gradle provides three options to declare our dependencies:


  1. compileOnly : It puts the dependency on the compile classpath only.
  2. runtimeOnly : It puts the dependency on the runtime classpath only
  3. implementation : It puts the dependency on both classpaths


We must use implementation rather than compile for dependencies, as compile is now deprecated or removed in the case of Gradle 7+.



Mahak Chahal

Investment Banker at Goldman Sachs

8 months ago

Featured Blogs
not found

Category: Investment

Author: Sushmita Pal

Posted : 1 days ago

0( 0 Comments )
not found

Category: Investment

Author: Sushmita Pal

Posted : 3 days ago

60( 0 Comments )
not found

Category: Startup

Author: Anushka Trivedi

Posted : 4 days ago

50( 0 Comments )
not found

Category: Investment

Author: Anushka Trivedi

Posted : 4 days ago

32( 0 Comments )
not found

Category: Investment

Author: Anushka Trivedi

Posted : 4 days ago

64( 0 Comments )
not found

Category: Startup

Author: Anushka Trivedi

Posted : 9 days ago

142( 0 Comments )
not found

Category: Startup

Author: Anushka Trivedi

Posted : 12 days ago

122( 0 Comments )
not found

Category: Technology

Author: Sweety Singh

Posted : 12 days ago

173( 0 Comments )
not found

Category: Stocks

Author: Sweety Singh

Posted : 14 days ago

69( 0 Comments )
not found

Category: Technology

Author: Sweety Singh

Posted : 14 days ago

53( 0 Comments )
Featured Questions
not found

Category: Social

Author: Ashmit Patel

Posted : 5 months ago

234( 0 Comments )
not found

Category: Technology

Author: Anwesha Chourasia

Posted : 5 months ago

162( 0 Comments )
not found

Category: Social

Author: Priya Gupta

Posted : 5 months ago

160( 0 Comments )
not found

Category: Politics

Author: Veer Pratap Singh

Posted : 5 months ago

80( 0 Comments )
not found

Category: Technology

Author: Naveen Sharma

Posted : 6 months ago

276( 0 Comments )
not found

Category: Technology

Author: Shruthi Sinha

Posted : 7 months ago

135( 0 Comments )

Category: Social

Author: Priya Tondon

Posted : 12 months ago

9( 1 Comments )

Category: Education

Author: Sakshi Shah

Posted : 1 years ago

11( 1 Comments )

Category: Education

Author: Lucky Homes

Posted : 1 years ago

16( 1 Comments )

Category: Education

Author: Lucky Homes

Posted : 1 years ago

8( 0 Comments )