You notice that your Maven build times are increasing significantly. What diagnostic steps would you take to identify the issue?

Diagnosing rising Maven build times is a systematic process of isolating which phase, plugin, or dependency is responsible, rather than guessing. It typically combines Maven's own diagnostic flags with dependency and environment analysis.

Key Points: • Run mvn dependency:tree to check for newly added or bloated dependencies that increase resolution and download time. • Use mvn -X for debug output to see detailed timing and identify which plugin executions are slow. • Check mvn -Dmaven.test.skip or profiling flags to isolate whether tests, compilation, or packaging is the bottleneck. • Review the pom.xml for inefficient or redundant plugin executions, especially ones that run in every phase unnecessarily. • Measure network/repository latency, since a slow or unavailable remote repository can dominate build time even when local logic is fast. • Consider a build scan or profiler (e.g. mvn -Dmaven.ext.class.path with a profiling extension) for a visual breakdown of time per phase.

Example: After noticing a jump from 3 to 12 minutes, running mvn dependency:tree revealed a newly added dependency pulling in a huge transitive graph from an internal artifact, and mvn -X showed most of the extra time was spent resolving those artifacts from a slow proxy repository.

Interview Tip: A concise interview answer is:

"I'd start by comparing dependency:tree output before and after the slowdown to catch new heavy dependencies, then run with -X to see which phase or plugin is actually consuming the time. From there I'd check network/repository latency and pom.xml plugin configuration, since those are the most common culprits for a gradual build slowdown."