Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.
What is the primary purpose of a build tool like Maven in software development?
Not quite. Try another option.
Answer: To automate processes like compiling, testing, and packaging code
Build tools exist to automate repetitive tasks such as compiling source code, running tests, managing dependencies, and packaging the application into a distributable format.
Question 2 of 60 · Problems solved by automated builds · Easy
Which of the following problems is commonly solved by using automated builds?
Not quite. Try another option.
Answer: Inconsistent and error-prone manual compilation steps
Automated builds eliminate the need for developers to manually execute build commands, reducing human error and ensuring a consistent build process across different environments.
Question 3 of 60 · Project Object Model (POM) · Easy
Which file serves as the core configuration file for a Maven project, defining dependencies and plugins?
Not quite. Try another option.
Answer: pom.xml
The pom.xml (Project Object Model) is the fundamental unit of work in Maven. It contains information about the project and configuration details used by Maven to build the project.
Question 4 of 60 · Directory structure · Easy
In Maven's standard directory layout, where is the main Java source code expected to be placed?
Not quite. Try another option.
Answer: src/main/java
Maven enforces a standard directory structure. The main Java source code is placed in src/main/java, while test code goes in src/test/java.
Question 5 of 60 · Build lifecycle phases · Easy
What is a Maven build lifecycle?
Not quite. Try another option.
Answer: A well-defined sequence of phases to build and distribute a project
A build lifecycle is an ordered sequence of phases (like compile, test, package) that Maven follows to complete tasks.
Question 6 of 60 · compile · Easy
Which Maven lifecycle phase translates the raw Java source code into bytecode (.class files)?
Not quite. Try another option.
Answer: compile
The compile phase is responsible for compiling the main source code of the project into executable bytecode.
Question 7 of 60 · package · Easy
What is the primary function of the Maven package phase?
Not quite. Try another option.
Answer: To bundle the compiled code into a distributable format like a JAR or WAR
The package phase takes the compiled code and packages it into its final format, typically a JAR (Java ARchive) or WAR (Web Application aRchive).
Question 8 of 60 · install · Easy
Which Maven phase copies the packaged artifact into the local repository, making it available as a dependency for other local projects?
Not quite. Try another option.
Answer: install
The install phase installs the package into the local repository (~/.m2/repository), allowing other projects on the same machine to use it as a dependency.
Question 9 of 60 · Parent POM · Easy
What is the main purpose of a Parent POM in Maven?
Not quite. Try another option.
Answer: To share common configurations and dependency versions across multiple sub-projects
A Parent POM is used to consolidate common settings, plugins, and dependency versions so that child projects can inherit them without code duplication.
Question 10 of 60 · Dependency scope · Easy
Which Maven dependency scope should be used for a library like JUnit, which is only needed when executing unit tests?
Not quite. Try another option.
Answer: test
The test scope indicates that the dependency is not required for normal use of the application, but is only needed for the test compilation and execution phases.
Question 11 of 60 · Transitive dependencies · Easy
How does Maven handle dependencies of dependencies (i.e., when a library you need requires another library)?
Not quite. Try another option.
Answer: It automatically pulls them in as transitive dependencies
Maven automatically resolves and downloads transitive dependencies—the libraries required by your direct dependencies—simplifying project configuration.
Question 12 of 60 · Using dependency Management · Easy
Which POM section allows you to centralize the versioning of dependencies without actually including them in the project?
Not quite. Try another option.
Answer: <dependencyManagement>
The <dependencyManagement> section is used to declare dependency versions centrally. Child POMs can then include the dependency without specifying a version, inheriting it from this section.
What is the primary use of the Maven Shade plugin?
Not quite. Try another option.
Answer: To create an "uber-jar" (fat jar) that contains both the compiled project code and all its dependencies
The Shade plugin packages the project and its dependencies into a single JAR file, commonly referred to as a fat jar or uber-jar, making it easy to execute.
Question 15 of 60 · Maven wrapper (mvnw) · Easy
What is the main benefit of including the Maven Wrapper (mvnw) in a project's repository?
Not quite. Try another option.
Answer: It allows developers to build the project without having to install Maven manually on their system
The Maven Wrapper (mvnw and mvnw.cmd) ensures that a user can run a Maven build with a specific version of Maven, even if Maven is not globally installed on their machine.
Question 16 of 60 · Maven and Docker Integration: dockerfile-maven-plugin · Easy
What does a plugin like dockerfile-maven-plugin allow developers to do?
Not quite. Try another option.
Answer: Build and push Docker images directly as part of the Maven build process
Maven Docker plugins bridge the gap between Java builds and containerization, allowing developers to build, tag, and push Docker images directly from Maven commands.
Question 17 of 60 · Dockerizing Maven-based applications · Easy
When Dockerizing a Maven application, what is typically copied into the final Docker image?
Not quite. Try another option.
Answer: The packaged artifact (e.g., JAR or WAR file) generated by Maven
Typically, the source code is built using Maven, and only the final packaged artifact (like a JAR file) is copied into the Docker image for deployment.
Question 18 of 60 · Pushing artifacts to registries · Easy
In a continuous integration pipeline, where are final build artifacts (like JARs or Docker images) usually pushed for sharing and deployment?
Not quite. Try another option.
Answer: An artifact repository or container registry (e.g., Nexus, Artifactory, Docker Hub)
After artifacts or images are built and tested, they are pushed to a central repository or registry so they can be downloaded and deployed to production environments.
Question 19 of 60 · Version conflicts & resolution · Easy
How does Maven typically resolve version conflicts when the same transitive dependency is included multiple times with different versions?
Not quite. Try another option.
Answer: It uses the "nearest definition" strategy in the dependency tree
Maven uses a "nearest definition" rule, meaning it will use the version of the dependency that is closest to your project in the dependency tree.
Question 20 of 60 · deploy · Easy
Which Maven phase copies the final packaged artifact to a remote repository to share it with other developers and projects?
Not quite. Try another option.
Answer: deploy
The deploy phase is the final phase in the default build lifecycle. It uploads the final artifact to a remote repository (like Nexus or Artifactory) for sharing.
Question 21 of 60 · Why build tools exist · Medium
A development team manually compiles their Java code, packages it, and copies it to a server. They frequently encounter the 'it works on my machine' syndrome. How does a build tool like Maven directly mitigate this specific issue?
Not quite. Try another option.
Answer: By standardizing the build process, dependency resolution, and environment expectations into a single configuration file.
Build tools like Maven establish a uniform, repeatable process (via the POM) for compiling, testing, and packaging, ensuring that builds are consistent regardless of the machine they are run on.
Question 22 of 60 · Problems solved by automated builds · Medium
When integrating an application into a CI/CD pipeline, which of the following is the primary problem solved by utilizing an automated build process rather than a manual one?
Not quite. Try another option.
Answer: Ensuring reproducible, error-free builds that do not rely on human intervention or specific developer environments.
Automated builds provide repeatability and consistency, removing the risk of human error and eliminating dependencies on a specific developer's local environment, which is crucial for CI/CD.
Question 23 of 60 · Project Object Model (POM) · Medium
You need to define a custom version string 1.5.0 that will be used by multiple dependencies in your pom.xml. How should you define and reference this property?
Not quite. Try another option.
Answer: Define it inside <properties><app.version>1.5.0</app.version></properties> and reference it as ${app.version}.
In Maven, custom variables are defined within the <properties> section of the POM and are accessed throughout the file using the ${propertyName} syntax.
Question 24 of 60 · Directory structure · Medium
You are adding an application configuration file (app-config.xml) that must be present on the classpath during the execution of unit tests, but it MUST NOT be included in the final production JAR. Where should you place this file in the standard Maven directory structure?
Not quite. Try another option.
Answer: src/test/resources
Files placed in src/test/resources are copied to the test classpath during the build process but are specifically excluded from the final production package.
Question 25 of 60 · Build lifecycle phases · Medium
A developer runs the command mvn install on a Maven project. Based on the default Maven lifecycle, which of the following phases will NOT be executed?
Not quite. Try another option.
Answer: deploy
The Maven build lifecycle is sequential. Running install executes all phases up to and including install (like compile, test, package, verify). deploy is the phase after install and will therefore not be executed.
Question 26 of 60 · validate, compile, test, package, verify, install, deploy · Medium
You want to ensure that your integration tests run and pass, and that the project meets quality criteria BEFORE it is copied into your local Maven repository. Which phase represents the culmination of these checks?
Not quite. Try another option.
Answer: verify
The verify phase is designed to run any checks on the results of integration tests to ensure quality criteria are met, and it happens immediately before the install phase.
Question 27 of 60 · Parent POM · Medium
In a multi-module Maven project, you want to ensure that all child modules use version 2.5.4 of a library if they choose to declare it, but you do not want to force the library to be included in modules that don't need it. How do you configure this in the Parent POM?
Not quite. Try another option.
Answer: Define the library within the <dependencyManagement> section of the Parent POM.
The <dependencyManagement> section allows you to consolidate and dictate dependency versions across child modules without actually adding the dependency to the modules unless explicitly declared in the child's <dependencies> section.
Question 28 of 60 · Dependency scope · Medium
You are developing a Java web application that uses the Servlet API. The application server (like Tomcat) will provide this API when the application is deployed. Which dependency scope should you use for javax.servlet-api to prevent it from being packaged in the final WAR file?
Not quite. Try another option.
Answer: provided
The provided scope indicates that you need the dependency to compile the code, but you expect the JDK or the application server to provide it at runtime. Thus, it is not packaged into the final artifact.
Question 29 of 60 · Transitive dependencies · Medium
Your project depends on Library A, which internally depends on Library B (v1.0). However, your project also requires Library B directly, but you specifically need version 2.0. To avoid unpredictable classpath behavior, how should you handle this?
Not quite. Try another option.
Answer: Use the <exclusion> tag inside Library A's dependency declaration to remove Library B, and explicitly declare Library B (v2.0) in your POM.
Using <exclusion> breaks the transitive dependency link for the unwanted version, and explicitly declaring the required version ensures the correct library is placed on the classpath.
Question 30 of 60 · Version conflicts & resolution · Medium
Your POM declares Dependency X first and Dependency Y second. Dependency X transitively brings in log-lib version 1.0. Dependency Y transitively brings in log-lib version 2.0. Both transitive dependencies are at the same depth in the dependency tree. According to Maven's mediation rules, which version of log-lib will be used?
Not quite. Try another option.
Answer: Version 1.0, because Maven uses the 'first declaration wins' strategy when depths are equal.
Maven resolves version conflicts using 'nearest definition' (shortest path). If the paths are of equal depth, Maven falls back to 'first declaration wins', selecting the version brought in by the dependency declared first in the POM.
Question 31 of 60 · Using dependency Management · Medium
What is the primary operational difference between declaring a dependency in <dependencies> versus <dependencyManagement>?
Not quite. Try another option.
Answer: <dependencies> includes the library in the build and classpath, while <dependencyManagement> only specifies default configurations (like version) for dependencies declared elsewhere.
<dependencyManagement> acts as a lookup table for versions and scopes. A library listed there is not included in the project unless it is explicitly called out in a <dependencies> block.
Question 32 of 60 · Maven Plugins & Execution: Compiler plugin · Medium
Your local machine runs Java 11 by default, but you need the Maven Compiler Plugin to compile your code strictly for Java 17. How can you configure this in the pom.xml?
Not quite. Try another option.
Answer: Configure the maven-compiler-plugin to use <source>17</source> and <target>17</target> (or <release>17</release>).
The Maven Compiler Plugin controls the Java version used for compilation. This is done by specifying the source and target configurations, or the newer release configuration.
Question 33 of 60 · Surefire plugin (unit testing) · Medium
During an emergency hotfix deployment, you need to build the project and compile the test classes, but you want to SKIP the actual execution of the unit tests to save time. Which command achieves this?
Not quite. Try another option.
Answer: mvn install -DskipTests
skipTests compiles the tests but skips executing them. maven.test.skip=true would skip both compilation and execution of the tests.
Question 34 of 60 · Shade plugin (uber jar) · Medium
You are developing a standalone Java utility and want to package the application along with all of its dependencies into a single, executable 'uber-jar'. Which Maven plugin is best suited for this task and resolving potential classpath overlaps?
Not quite. Try another option.
Answer: maven-shade-plugin
The Maven Shade plugin provides the capability to package an artifact in an uber-jar, which includes all dependencies. It also provides advanced features like renaming packages (shading) to avoid classpath conflicts.
Question 35 of 60 · Maven wrapper (mvnw) · Medium
A new developer clones your project repository but does not have Maven installed on their system. The repository contains mvnw and mvnw.cmd files. What is the correct way for them to build the project?
Not quite. Try another option.
Answer: They can run ./mvnw clean install which will automatically download the correct Maven version and execute the build.
The Maven Wrapper (mvnw) ensures that a user can run a Maven build without needing a pre-installed Maven environment. It automatically downloads the specified Maven version for that project and executes the command.
Question 36 of 60 · Maven and Docker Integration: dockerfile-maven-plugin · Medium
When using a Maven plugin to build Docker images (like dockerfile-maven-plugin or similar), how is the finalized JAR file name dynamically passed into the Dockerfile so that it can be copied into the image?
Not quite. Try another option.
Answer: By using the <buildArgs> configuration in the plugin to map a Maven property like ${project.build.finalName} to an ARG in the Dockerfile.
Maven Docker plugins allow mapping Maven properties (like the dynamically generated final artifact name) to Docker build arguments using the <buildArgs> block, which are then consumed by ARG instructions in the Dockerfile.
Question 37 of 60 · Dockerizing Maven-based applications · Medium
You are writing a multi-stage Dockerfile to build a Maven application. To optimize the Docker build cache and avoid re-downloading dependencies every time the source code changes, what is the best sequence of instructions?
Not quite. Try another option.
Answer: Copy only pom.xml, run mvn dependency:go-offline, then copy the source code and run mvn package.
Copying the pom.xml and downloading dependencies first leverages Docker's layer caching. Unless the POM changes, Docker caches the downloaded dependencies, significantly speeding up subsequent builds when only source code changes.
Question 38 of 60 · Pushing artifacts to registries · Medium
When configuring Maven to deploy a built artifact to a remote private registry (like Nexus or Artifactory), you must provide authentication credentials. According to Maven security best practices, where should these credentials be stored?
Not quite. Try another option.
Answer: In the developer's local ~/.m2/settings.xml file mapped to the repository ID.
Sensitive information like usernames and passwords should never be stored in the project's POM. Instead, they are defined in the user's settings.xml under the <servers> section, linking to the repository ID.
Question 39 of 60 · Dependency scope · Medium
Your Java application connects to a MySQL database. You need the MySQL JDBC driver to connect at runtime, but your code is written exclusively using the generic java.sql interfaces, so the driver is not needed for compilation. Which dependency scope is most appropriate for the MySQL driver?
Not quite. Try another option.
Answer: runtime
The runtime scope indicates the dependency is not required for compilation but is required for execution. It will be included in the runtime and test classpaths, and packaged in the final artifact.
Question 40 of 60 · validate, compile, test, package, verify, install, deploy · Medium
A CI/CD pipeline executes the command mvn clean deploy. How does Maven process this command?
Not quite. Try another option.
Answer: It runs the clean phase, then sequentially executes all default lifecycle phases starting from validate up to and including deploy.
Maven commands execute sequential lifecycles. mvn clean deploy first executes the clean lifecycle (removing the target directory) and then executes the default lifecycle from the beginning (validate, compile, test, package, install) all the way through the deploy phase.
Question 41 of 60 · Version conflicts & resolution · Hard
In a Maven dependency tree, Project A depends on Lib B and Lib C. Lib B depends on Lib D (version 2.0). Lib C depends on Lib E, which in turn depends on Lib D (version 1.0). If Lib B is declared before Lib C in Project A's POM, which version of Lib D is included in the final artifact, and why?
Not quite. Try another option.
Answer: Lib D (version 2.0), because Maven uses the 'nearest definition' rule, and the path to version 2.0 is shorter (depth 2 vs depth 3).
Maven resolves version conflicts using the 'nearest definition' rule. The path A -> B -> D (2.0) has a depth of 2, while the path A -> C -> E -> D (1.0) has a depth of 3. Therefore, version 2.0 is chosen. The 'first declaration wins' rule only applies when the depths are equal.
Question 42 of 60 · Using dependency Management · Hard
Project A imports a Bill of Materials (BOM) in its <dependencyManagement> section, which specifies com.example:core-lib:1.0. In the <dependencies> section of Project A, com.example:core-lib is declared with version 2.0. Module B, a child of Project A, declares com.example:core-lib without a version. What version of core-lib does Module B resolve?
Not quite. Try another option.
Answer: Version 2.0, because direct dependency declarations override versions managed in <dependencyManagement>, and this override is inherited.
In Maven's inheritance and resolution hierarchy, a directly declared dependency in the <dependencies> section overrides the version specified in the <dependencyManagement> section (including imported BOMs). Child modules inherit the resolved dependencies from the parent, so Module B gets version 2.0.
Question 43 of 60 · Parent POM · Hard
A parent POM defines the maven-antrun-plugin exclusively inside the <pluginManagement> section and binds an execution to the validate phase. A child module inherits from this parent but does not mention the maven-antrun-plugin in its own POM. What happens when mvn validate is run on the child module?
Not quite. Try another option.
Answer: The maven-antrun-plugin does not execute because <pluginManagement> only configures plugins; they must be explicitly declared in the child's <plugins> section to be invoked.
<pluginManagement> acts as a template for plugin configurations. For a plugin defined there to actually execute in a module, it must be explicitly referenced in the <plugins> section of that specific module's POM (or the parent's <plugins> section).
Question 44 of 60 · Shade plugin (uber jar) · Hard
When creating an Uber JAR using the maven-shade-plugin for an application heavily utilizing the Spring Framework, the resulting JAR throws schema errors at runtime. This happens because multiple dependencies contain different META-INF/spring.handlers files. How must this be resolved in the Shade plugin configuration?
Not quite. Try another option.
Answer: Use the AppendingTransformer specifically mapped to the META-INF/spring.handlers resource.
Spring relies on spring.handlers and spring.schemas files in the META-INF directory to parse custom XML configurations. If multiple jars have these files, the Shade plugin overwrites them by default, leaving only the last one. The AppendingTransformer combines the contents of all matching files across dependencies instead of overwriting them.
Question 45 of 60 · Dependency scope · Hard
A project declares Dependency X with <scope>provided</scope>. Dependency X transitively depends on Dependency Y with <scope>compile</scope>. What is the effective scope of Dependency Y in the root project?
Not quite. Try another option.
Answer: Provided
When a direct dependency has the provided scope, its transitive compile or runtime dependencies are typically pulled in with the provided scope in the root project. This assumes the environment providing the direct dependency will also provide its transitives.
Question 46 of 60 · verify · Hard
When running integration tests with the maven-failsafe-plugin, what is the key functional difference between stopping at the integration-test phase versus proceeding to the verify phase?
Not quite. Try another option.
Answer: The integration-test phase executes the tests but does not fail the build if tests fail; the verify phase evaluates the results and fails the build if necessary.
The Failsafe plugin is designed to run in integration-test and generate summary files. It intentionally does not fail the build immediately, allowing post-integration-test cleanup (like shutting down servers) to occur. The failsafe:verify goal, bound to the verify phase, reads the summaries and fails the build if tests failed.
Question 47 of 60 · Maven wrapper (mvnw) · Hard
You are utilizing the Maven Wrapper (mvnw) to ensure uniform build environments. A developer's machine resides behind a strict corporate firewall that blocks direct access to Maven Central, preventing mvnw from downloading the Maven distribution. How can you configure the wrapper to fetch the Maven distribution from an internal Artifactory server?
Not quite. Try another option.
Answer: Modify the distributionUrl property inside the .mvn/wrapper/maven-wrapper.properties file.
The Maven Wrapper bootstraps Maven by downloading it if it is not present. The location from which it downloads the Maven distribution archive is strictly governed by the distributionUrl defined in .mvn/wrapper/maven-wrapper.properties.
Question 48 of 60 · Maven and Docker Integration: dockerfile-maven-plugin · Hard
When utilizing the dockerfile-maven-plugin to build a Docker image, you want to dynamically pass the final built JAR filename into the Dockerfile as an argument. How is this correctly accomplished mapping Maven coordinates to Docker ARGs?
Not quite. Try another option.
Answer: By declaring ARG JAR_FILE in the Dockerfile and passing <buildArgs><JAR_FILE>${project.build.finalName}.jar</JAR_FILE></buildArgs> in the plugin configuration.
The best practice for passing dynamic Maven properties to a Dockerfile using dockerfile-maven-plugin is to configure <buildArgs> in the POM, which directly maps to ARG instructions declared in the Dockerfile.
Question 49 of 60 · Pushing artifacts to registries · Hard
A CI pipeline needs to push a compiled Maven artifact to a private Nexus repository. The repository URL is defined in the project's POM under <distributionManagement>. Authentication is required. Where and how must the credentials be configured to ensure Maven successfully authenticates during the deploy phase?
Not quite. Try another option.
Answer: In the ~/.m2/settings.xml file under <servers>, mapping the <server><id> exactly to the <repository><id> specified in the POM's <distributionManagement>.
For security reasons, Maven requires credentials for artifact registries to be securely stored outside the POM (usually in settings.xml). Maven matches the <id> of the <server> in settings.xml to the <id> of the <repository> in the POM's <distributionManagement> to apply the correct credentials.
Question 50 of 60 · Surefire plugin (unit testing) · Hard
A developer executes mvn package -DskipTests. Which of the following accurately describes the behavior of the maven-surefire-plugin and the build lifecycle in this scenario?
Not quite. Try another option.
Answer: Test sources are compiled into the target/test-classes directory, but the actual execution of unit tests is bypassed.
The -DskipTests flag specifically instructs the Surefire plugin to skip test execution, but it still allows the test-compile phase to build the test classes. To skip both compilation and execution, the -Dmaven.test.skip=true flag is used.
Question 51 of 60 · Problems solved by automated builds · Hard
To solve the problem of non-reproducible builds where two builds from identical source code generate JARs with different SHA-256 hashes, what Maven property should be configured to ensure deterministic archive entries?
Not quite. Try another option.
Answer: <project.build.outputTimestamp>
Maven generates ZIP/JAR archives with timestamps for each file. By setting <project.build.outputTimestamp>, you lock the timestamps used for files added to the archive (usually to the timestamp of the last Git commit), resulting in byte-for-byte identical, reproducible archives.
Question 52 of 60 · Directory structure · Hard
A legacy Java project contains source code in both src/main/java and src/legacy/java. How can you correctly configure Maven to compile sources from both directories without breaking standard plugin lifecycles?
Not quite. Try another option.
Answer: Use the build-helper-maven-plugin with the add-source goal to register src/legacy/java as an additional source root.
Maven's standard <sourceDirectory> only accepts a single path. To securely and properly add supplementary source directories so that standard tools (compiler, IDEs, Javadoc) recognize them, the build-helper-maven-plugin with the add-source goal is required.
Question 53 of 60 · deploy · Hard
A project is defined with <packaging>pom</packaging>. You execute the command mvn deploy. Which of the following statements is true regarding the execution of the compiler and surefire plugins during this run?
Not quite. Try another option.
Answer: Neither plugin executes because POM packaging explicitly unbinds the goals normally associated with compilation and testing.
The <packaging> element determines the default lifecycle bindings. For pom packaging, the compile and test phases have no native plugin goals bound to them. Thus, while Maven passes through these phases during mvn deploy, no compilation or testing actually occurs.
Question 54 of 60 · Project Object Model (POM) · Hard
When resolving the Effective POM, which of the following configuration sources has the highest overriding precedence for defining a specific property value?
Not quite. Try another option.
Answer: Properties defined in an active profile within the ~/.m2/settings.xml file.
Properties defined in active profiles inside settings.xml override properties defined directly in the project pom.xml or its parent. (Command-line -D arguments would override settings.xml, but are not listed).
Question 55 of 60 · Compiler plugin · Hard
When configuring the maven-compiler-plugin to run a custom annotation processor (e.g., MapStruct or Lombok), what is the effect of declaring the processor dependency inside the <annotationProcessorPaths> configuration tag rather than in the project's general <dependencies>?
Not quite. Try another option.
Answer: It isolates the annotation processor so it does not leak into the project's runtime or compile classpath, strictly keeping it as a build-time tool.
Using <annotationProcessorPaths> limits the visibility of the specified JARs to the compiler's annotation processing stage only. They do not pollute the project's actual compile, test, or runtime classpaths.
Question 56 of 60 · Dockerizing Maven-based applications · Hard
When writing a multi-stage Dockerfile for a Maven application to optimize build caching, what is the correct order of operations to ensure that dependency downloading is cached as a separate Docker layer?
Not quite. Try another option.
Answer: COPY pom.xml RUN mvn dependency:go-offline COPY src RUN mvn package
To leverage Docker's layer caching, the pom.xml is copied first, followed by fetching dependencies (dependency:go-offline). This layer remains cached as long as the POM doesn't change. Source code is copied afterward, so only the compilation layer is rebuilt when code changes.
Question 57 of 60 · Transitive dependencies · Hard
Project A declares direct dependencies on Module B and Module C. Module B depends on Lib D (v1.0). Module C also depends on Lib D (v1.0). If you explicitly declare an <exclusion> for Lib D inside the dependency block for Module B in Project A's POM, what happens to Lib D?
Not quite. Try another option.
Answer: Lib D is still included in Project A's classpath because it is transitively provided via Module C.
Exclusions are specific to the dependency node where they are declared. Excluding Lib D from Module B prevents it from coming down that specific branch of the tree, but because Module C still brings it in, Maven resolves and includes Lib D.
Question 58 of 60 · Dependency scope · Hard
Which of the following restrictions applies to the import dependency scope in Maven?
Not quite. Try another option.
Answer: It can only be used with <type>pom</type> and must be placed inside the <dependencyManagement> section.
The import scope is uniquely designed to import dependencies specified in the <dependencyManagement> section of another POM. It requires the dependency type to be pom.
Question 59 of 60 · Build lifecycle phases · Hard
A custom Maven plugin has a goal specifically bound to the process-classes phase. A developer executes mvn test-compile. Will the custom plugin execute?
Not quite. Try another option.
Answer: Yes, because process-classes precedes test-compile in the default build lifecycle.
The standard Maven lifecycle order is: validate, compile, process-classes, generate-test-sources, process-test-sources, test-compile. Since process-classes happens before test-compile, invoking test-compile will execute the process-classes phase as a prerequisite.
Question 60 of 60 · Version conflicts & resolution · Hard
In a Maven tree, Dependency A requests Lib X with version range [1.0, 2.0). Dependency B requests Lib X with version range [1.5, 2.5]. If both A and B are included in a project, what version constraint will Maven use to resolve Lib X?
Not quite. Try another option.
Answer: Maven resolves the intersection of the ranges: [1.5, 2.0).
When dealing with multiple version ranges for the same artifact, Maven attempts to satisfy all conditions by finding the mathematical intersection of the required ranges. Here, the intersection of >=1.0 and <2.0 with >=1.5 and <=2.5 is [1.5, 2.0).
That's unit 4
Answer a few questions and your score shows up here.
Nearly through. Did unit 4 of INT332 save you a night before the exam?
LPU Notes is free. A student pays for the servers.
Did unit 4 of INT332 save you a night before the exam?
Then you can help keep it free for the next batch. Ads cover part of the server bill;
the rest comes out of a student's own pocket: the domain, the storage, and keeping
the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason.
to try again.