Reputation: 29750
I have some questions about Gradle.
buildscript.dependencies
and
dependencies
?classpath
and compile
?apply plugin:
mean?Upvotes: 3
Views: 64
Reputation: 15235
I suggest you download the full Gradle distribution, only because it provides a PDF version of the User Guide (I don't know of any other way to get the user guide PDF). Read it from top to bottom, skipping chapters that are clearly irrelevant to you. You will get answers to all of these questions, and more that you haven't asked yet.
However, I'll give you some brief answers.
Q1: Gradle has dependencies for the build script, and dependencies for the code you're building. They are separate.
Q2: Classpath is a runtime notion used by Java, which Gradle utilizes in different ways. Compile is a "configuration" which you can add dependencies to, which affects the eventual runtime classpath.
Q3: "apply plugin" is applying a Gradle plugin. Read the user guide.
Upvotes: 1
Reputation: 1583
Just check their docs, they have described it well. But here is it: 1:
If your build script needs to use external libraries, you can add them to the script's classpath in the build script itself. You do this using the buildscript() method, passing in a closure which declares the build script classpath.
This is good for external dependencies (for example from internet repos which are in buildscript part too.)
2: Docs with table and descriptions for each. compile will get dependencies during compiling. (for example you can set 'runtime' and these dependencies will be used during runtime, or testCompile will be used only during compiling tests). This is very important! Read their docs. Of course you can try to compile everything everytime, but this is really bad idea. Good example are JUnit tests, you need JUnit only during compiling tests co then you use compileTest:
testCompile "junit:junit:X.YZ"
3: It means that you applied plugin :) You apply java, or when you need spring or spring boot, then you simply can tell Gradle, hey Gradle, I am going to using this, so aplly it. More here.
Upvotes: 1