compile
is the group of dependencies you need to build your application while testCompile
is a group of dependencies that you need only for testing.
Look for instance at this build.gradle
(taken from here)
apply plugin: 'java'
repositories {
mavenCentral()
}
dependencies {
compile group: 'org.hibernate', name: 'hibernate-core', version: '3.6.7.Final'
testCompile group: 'junit', name: 'junit', version: '4.+'
}
This specifies that hibernate-core
is needed to build your code but junit
(a testing framework) is needed just for testing. Since it's not needed at runtime, it's not going to be included in the released package.