61029

Gradle - difference between implementation and runtime

<h3>Question</h3>

Having read this Gradle documentation I understand the difference between api and implementation. However I'd like to know if there's a difference between implementation and the deprecated runtime.

According to this table there is no difference in behavior, but using runtime in practice seems to "leak" the compile classpath when I was trying it out and so the classes I was trying to hide was actually being exposed to the consuming module.


<h3>Answer1:</h3>

implementation dependencies are added to the compilation classpath of the project they are declared in. That is not the case for runtime dependencies.

If you're talking purely about how implementation and runtime dependencies affect consumers of the project, the 4.6 release notes state that runtime dependencies have always been included on the compilation classpath, which is why you're seeing the leakage.

If you published a library with implementation dependencies, those dependencies would be marked as runtime scope in the POM, and I suspect that they would also be included in the compilation classpath of consuming projects. You would need to enable the IMPROVED_POM_SUPPORT feature to change that.

来源:https://stackoverflow.com/questions/51127422/gradle-difference-between-implementation-and-runtime

Recommend

  • How do you represent MS-DTYP `DATETIME` in Java 8 Instant?
  • get value of checkbox in symfony
  • ImageView in CardView not show radius on Android 4.3
  • How to call fgets in x86 assembly?
  • Can I use servlet api 3.0 and jetty 8?
  • Why OpenFST does not seem to have 'run' or 'accept' or 'transduce' com
  • Is there a way to define a constant array in PHP? [duplicate]
  • Using GraphQL Fragment on multiple types
  • JS insert into array at specific index [duplicate]
  • Syntax error or access violation: 1059 Identifier name is too long
  • Camera2 Set Fixed Resolution
  • Continuous colorbar with contour levels
  • has_and_belongs_to_many relationship not associating both ways
  • How to start camel even if the MQTT server is not reachable
  • Adjoining “f” and “l” characters
  • How to change type datatable column [duplicate]
  • How to process future stream to create an instance of class with list property
  • Clojure; select all nth element from list of lists with unequal size, for n = 1, 2,
  • Fantasy Font Loading differently in ie
  • pyodbc fails without error
  • Change ActionBar color in a Fragment
  • Eclipse ADT Plugin crashed after updating to version 22.0
  • Authorization Policies/Gates for Laravel 5.3 web app consuming own API w/ Passport
  • Encode string to Base64 in Inno Setup (Unicode Version of Inno Setup)
  • How do I hide and show the contents contents of a modal?
  • Display standard razor/mvc 3 validation messages displayed in another language
  • Using one probability set to generate another [duplicate]
  • Velocity (VM) template request parameters: Getting GET variables
  • How to use template selector within a ContentPresenter in Windows 8.1
  • no endpoints available for service \\“kubernetes-dashboard\\”
  • Working with codeception and laravel
  • Arc gradients in Flutter?
  • Laravel 5 - Cache remember doesn't work
  • Execute powershell script on a remote computer using C#
  • Combine two jagged lists into one
  • Facebook friend list in Facebook Android SDK 3.14
  • How to join two tables from different databases
  • trigger ontouch event programmatically
  • Drag and drop unicode TText in DelphiXe4
  • Apple Mach-O Linker error (“duplicate symbol”)