Note: this box contains optional background information: you do
not need to know any of the information presented here.
When working on larger projects, programmers tend to face a few different
problems:
- How do you keep track of what 3rd party libraries the project
needs installed?
- Each IDE stores its project config in a slightly different way. How can
you make sure your project can run on all kinds of different IDEs,
including ones you've never heard of, with minimal fuss?
- Sometimes, building our project and producing a final JAR we can
give to our users can require running multiple instructions/performing
several complex steps. Instead of having to do that manually, can we just
write a script that does this all automatically for us?
It turns out that we can use the same tool to answer all of these questions:
we can use a build manager. Basically, what happens is that we record
all of the libraries we need, all project configuration, and all build instructions
inside of a special file our build manager understands.
Conveniently, it also turns out that all (modern) IDEs have great support for
a wide variety of popular build managers: they can read the special file and
automatically convert all of those instructions into their IDE-specific configuration.
In our case, we're using a build manager called "gradle". Try opening up
build.gradle
inside of your project. If you skim through it, you
can see that the file configures a variety of things and specifies a handful
of 3rd party libraries we want to install and use. (We've commented this file
fairly heavily in case you're curious).
Gradle isn't the only build manager – other popular build managers for
Java include Ant, Maven, and Ivy.
If you start working with other programming languages, you'll learn that they all
also have their own build managers and conventions for managing large projects. However,
at a high level, they all work in the same way: you specify the libraries you need and
your build instructions in some file(s), and run some sort of build tool to manage
everything for you.