Alexander
Alexander

Reputation: 533

Do the dependencies in build.gradle generated automatically?

Does gradle work like go mod ? First importing some dependencies in java file such as import org.apache.hadoop.mapreduce.Mapper, then calling gradle build and gradle would generate dependencies in build.gradle automatically, also download all the jars needed to gradle cache.

Or, all the denpendencies we need must add to build.gradle manully? Which version should append to the denpendency, search in the maven repo one by one?

Thank~

Upvotes: 0

Views: 90

Answers (1)

Louis Jacomet
Louis Jacomet

Reputation: 14500

Gradle uses the dependencies declared in the build file to create the compile classpath. Similarly it will use test dependencies for the test compile classpath and the test runtime classpath.

So you have to declare the dependencies first, including figuring out which version you want to use in your project, and then you will be able to compile and run code that leverages these libraries.

Upvotes: 1

Related Questions