Loading topic
main method. You compiled it and ran it. That works for one file. Real projects are bigger. They have many files, tests, and code written by other people. This chapter explains the problem that grows with them and how a build tool solves it.5 min readsrc/main/java, src/test/java, and a few others. That is not chance. Both tools expect one shared layout. If you put your files where the tool expects them, you need almost no setup at all.4 min readapp.jar. That name works on your own machine. Now picture thousands of teams, each publishing a file called app.jar. Nobody could tell them apart. This chapter covers the naming system that Maven and Gradle use to give every library a5 min readpom.xml, and uses it to compile your code, run your tests, and package everything into a JAR file. A JAR file is a single archive that holds your compiled classes. This chapter shows you how to set up a small Maven project and what each par5 min readpom.xml. That file describes your project, but it never says "first compile, then test, then make a JAR." Maven already knows that order. It is built into a set of fixed steps called the lifecycle. This chapter explains the lifecycle, what happens at each step, 5 min readpom.xml, choose 5 min readpom.xml describes a project. Gradle is another build tool for Java. A build tool is a program that compiles, tests, and packages your code for you. Gradle uses the same folder layout as Maven, so the Java files from earlier chapters 5 min readbuild.gradle.kts file. Gradle reads that file, but it does no work on its own. All the work happens in tasks. This chapter explains what a task is, how tasks depend on each other, and how Gradle decides which tasks to run and in what order.5 min readcompile or test. Gradle does the same job with configurations. A configuration is a named bucket of dependencies. Each bucket has a set of rules about when its contents are available: while compiling, while running, or only during tests.5 min read./gradlew build twice in a row, the second run finishes much faster than the first. Gradle notices that nothing changed and skips the work it already did. This chapter explains how Gradle decides what to skip. It covers two features: incremental builds and the build cache.5 min read