Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle dependencies: What's the difference between compile project and compile name?

Tags:

android

gradle

Sample code

dependencies {    
    compile project (':aProject')
    compile name: 'somefile'
    compile files('libs/something_local.jar')
    compile 'com.google.code.gson:gson:2.3.1'
}

My questions are

  1. What's the difference between compile project and compile name here?

  2. Is compile name the same as compile files?

  3. When do you use compile directly as shown in the 5th line of code

  4. What does compile do here? Is it compiling the files inside bracket/single quotes? Can I use something like 'build' etc.?

like image 276
nieschumi Avatar asked Oct 02 '15 05:10

nieschumi


1 Answers

Compile means, it is compiling the library in other to be used on your project

compile project (':aProject')

  • It compiles the module from your project

compile files('libs/something_local.jar')

  • It compiles a file from your project (usually it is on lib directory)

compile name: 'something_local'

compile(name:'something_local', ext:'jar')

  • It is the same as compile files, but your are indicating the directory of the file the repositories (like compiling from a remote repository but it is from local)

compile 'com.google.code.gson:gson:2.3.1'

  • It compiles the library from a maven repository, you use this instead of cloning the library project and putting it to your project.
like image 198
NaviRamyle Avatar answered Sep 22 '22 13:09

NaviRamyle