skip to content

Build Tools

The build systems and compilers that turn sources into artifacts: task graphs, dependency resolution, caching, packaging, and reproducibility across JVM and native ecosystems. Interviewers ask because nothing ships, tests, or debugs without someone understanding the build.

on this pageshow

explore

questions

1 734 · 4 sections

How do you inspect the full dependency graph of a Maven project, and what does dependency:tree show you?

level: juniorimportance: must knowfreq 80%
basics
~10 s

Run mvn dependency:tree. It prints every dependency your project pulls in, including transitive ones, as an indented tree showing which dependency brought in which, plus the scope and version of each.

open as a page

What are the dependency scopes in Maven, and what is each one used for?

level: juniorimportance: must knowfreq 85%
basics
~20 s

Maven has six scopes: compile (default, everywhere), provided (compile/test only, supplied at runtime by the container), runtime (not for compiling, needed to run), test (only for tests), system (like provided but you give a local jar path), and import (only for BOMs in dependencyManagement).

open as a page

What are transitive dependencies in Maven, and where do they come from?

level: juniorimportance: must knowfreq 75%
basics
~10 s

Transitive dependencies are the dependencies of your dependencies. If you declare library A and A needs B, Maven automatically downloads B too, so you don't have to list it yourself.

open as a page

What does the <dependencyManagement> section in a pom.xml do, and how is it different from a plain <dependencies> section?

level: juniorimportance: must knowfreq 75%
basics
~20 s

<dependencyManagement> declares versions (and other settings) centrally but does NOT add the dependency to the build. Child modules that list the same dependency without a version inherit the managed version. Plain <dependencies> actually pulls the jar onto the classpath.

open as a page

What is a Maven archetype, and how do you use archetype:generate to scaffold a new project?

level: juniorimportance: must knowfreq 55%
basics
~10 s

An archetype is a project template. You run mvn archetype:generate, pick a template, and answer prompts for groupId, artifactId and version; Maven creates a ready-to-build project skeleton from that template.

open as a page

What is the Gradle Worker API, and why would a custom task use it instead of just running its work directly in the task action?

level: juniorimportance: must knowfreq 55%
basics
~20 s

The Worker API lets a task hand units of work to Gradle's worker pool so they run in parallel. You inject WorkerExecutor, define a WorkAction, and submit work to a queue. It enables parallelism and isolation that a plain task action can't get.

open as a page

What does Property.convention(...) do on a Gradle lazy property, and how does it differ from calling set(...)?

level: juniorimportance: must knowfreq 62%
basics
~10 s

convention(...) supplies a default value used only if nobody calls set(...). set(...) is an explicit assignment that overrides any convention. So convention = fallback default, set = the actual chosen value.

open as a page

What is a Gradle DSL extension, and how do you register one from a plugin so users can configure your plugin in their build script?

level: juniorimportance: must knowfreq 70%
basics
~10 s

An extension is an object added to a project that exposes a configuration block (DSL). A plugin registers it with project.extensions.create("myExt", MyExtension::class.java), then users configure it via a myExt { ... } block.

open as a page

What is a NamedDomainObjectContainer in Gradle, and why would a plugin author expose one in their extension?

level: juniorimportance: must knowfreq 55%
basics
~10 s

It's a Gradle collection of objects each identified by a unique name. Plugins expose one so users can declare multiple named instances in a DSL block, like sourceSets or configurations.

open as a page

Your plugin defines an extension with a `Property<String>` called `greeting`. How do you connect that extension value to a task's input property so the task uses whatever the user sets in the build script?

level: juniorimportance: must knowfreq 60%
basics
~10 s

Use task.greeting.set(extension.greeting). This wires the task's Property to the extension's Property lazily, so the value is read later (at execution), not while configuring.

open as a page

In CMake, what do the Debug, Release, RelWithDebInfo and MinSizeRel build types change, and how does CMAKE_BUILD_TYPE select one?

level: juniorimportance: must knowfreq 70%
basics
~20 s

Each build type adds its own flags from CMAKE_CXX_FLAGS_<CONFIG>: with GCC or Clang, Debug adds -g, Release -O3 -DNDEBUG, RelWithDebInfo -O2 -g -DNDEBUG, MinSizeRel -Os -DNDEBUG. Single-config generators take the type from CMAKE_BUILD_TYPE at configure time; left empty, none of these flags apply.

open as a page

In CMake, what do enable_testing() and add_test() do, and how does ctest find and run the tests they register?

level: juniorimportance: must knowfreq 60%
basics
~20 s

enable_testing() makes CMake write CTestTestfile.cmake files into the build tree, and add_test(NAME ... COMMAND ...) records a command in them. ctest, run in the top-level build directory, reads those files and runs each command; exit code 0 passes.

open as a page

In CMake, why link the imported target ZLIB::ZLIB after find_package(ZLIB) instead of using ZLIB_INCLUDE_DIRS and ZLIB_LIBRARIES?

level: juniorimportance: must knowfreq 60%
basics
~20 s

An imported target bundles the include directories, link file and other usage requirements in one name, so a single target_link_libraries call applies them all, CMake errors on a misspelled name, and per-configuration library paths are chosen for you.

open as a page

In CMake, what does a generator do, how do you choose one with -G, and why does a build directory keep only one?

level: juniorimportance: must knowfreq 62%
basics
~20 s

A CMake generator writes the native build system: Makefiles, build.ninja, a Visual Studio solution or an Xcode project. You pick it with -G when a build directory is first configured; the choice is recorded there, so another generator needs another or a fresh directory.

open as a page

In CMake, what do the PRIVATE, PUBLIC and INTERFACE keywords mean in target_link_libraries and target_include_directories?

level: juniorimportance: must knowfreq 82%
basics
~20 s

They decide who receives a setting. PRIVATE applies it only when building the target itself, INTERFACE only to targets that link to it, and PUBLIC to both, so a dependency that a library's public headers include must be PUBLIC.

open as a page

What do GCC's -O0, -O1, -O2, -O3, -Os and -Og each trade off, and which level is the default?

level: juniorimportance: must knowfreq 72%
basics
~20 s

-O0, the default, barely optimizes so builds are fast and debugging is exact. -O1 adds cheap optimizations, -O2 nearly all that do not trade size for speed, -O3 adds aggressive loop work, -Os favours size, and -Og keeps debugging usable.

open as a page

What does GCC's -g option add to an object file, and how do -g1, -g3 and -ggdb differ?

level: juniorimportance: must knowfreq 60%
basics
~20 s

-g adds debugging information, normally DWARF sections describing types, variables and line numbers, without changing the generated instructions. -g1 keeps functions, external variables and line tables, the default -g2 adds locals, -g3 adds macro definitions, and -ggdb prefers GDB extensions.

open as a page

What stages does the g++ driver run, and where do the -E, -S and -c options stop it?

level: juniorimportance: must knowfreq 72%
basics
~20 s

g++ is a driver that runs the preprocessor, the compiler proper, the assembler and the linker in that order. -E stops after preprocessing, -S after producing assembly (.s), and -c after assembling an object file (.o).

open as a page

With GCC, does -Wall turn on every warning, and what do -Wextra and -Wpedantic add on top of it?

level: juniorimportance: must knowfreq 72%
basics
~10 s

No. GCC's -Wall is a curated set of easy-to-fix warnings; -Wextra adds more, such as unused parameters; -Wpedantic reports extensions ISO C++ forbids. Useful warnings like -Wconversion and -Wshadow are in none of them.

open as a page

When building a shared library with GCC, what do -fPIC, -shared and -fvisibility=hidden each contribute?

level: middleimportance: must knowfreq 58%
basics
~20 s

-fPIC compiles position-independent code that reaches globals through a table, so the library can load at any address. -shared makes the linker produce a .so. -fvisibility=hidden keeps symbols private unless marked default, shrinking exports and enabling direct calls.

open as a page