Challenge - 5 Problems
Maven Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output of this Maven command?
You run the command
mvn archetype:generate -DgroupId=com.example -DartifactId=myapp -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false. What is the expected result?Attempts:
2 left
💡 Hint
The command uses the quickstart archetype to create a new project non-interactively.
✗ Incorrect
The command generates a new Maven project named 'myapp' with the standard quickstart template, including basic source folders and a sample Java class.
❓ assertion
intermediate1:30remaining
Which assertion correctly verifies the Maven project directory contains the 'pom.xml' file?
You want to write a Selenium Java test to check if the 'pom.xml' file exists in the project root folder. Which assertion is correct?
Selenium Java
File pomFile = new File("./pom.xml");Attempts:
2 left
💡 Hint
Check if the file exists returns true when the file is present.
✗ Incorrect
The assertion assertTrue(pomFile.exists()) verifies that the pom.xml file is present in the current directory.
🔧 Debug
advanced2:30remaining
Why does this Maven build fail with 'Could not find artifact' error?
Given the
pom.xml snippet below, the Maven build fails with 'Could not find artifact com.example:mydependency:jar:1.0'. What is the most likely cause?Selenium Java
<dependency>
<groupId>com.example</groupId>
<artifactId>mydependency</artifactId>
<version>1.0</version>
</dependency>Attempts:
2 left
💡 Hint
Check if the dependency is published in any repository Maven can access.
✗ Incorrect
Maven cannot find the artifact because it is not published in any repository listed in the pom.xml or settings.xml.
❓ framework
advanced1:30remaining
Which Maven plugin is best for running Selenium tests during the build?
You want to run Selenium WebDriver tests automatically during the Maven build lifecycle. Which plugin should you configure in your pom.xml?
Attempts:
2 left
💡 Hint
This plugin runs unit and integration tests during the test phase.
✗ Incorrect
The maven-surefire-plugin runs tests during the Maven test phase, including Selenium tests written in Java.
🧠 Conceptual
expert2:00remaining
What is the purpose of the
src/test/java directory in a Maven project?In a Maven project structure, what is the main role of the
src/test/java folder?Attempts:
2 left
💡 Hint
Think about where test code is separated from main application code.
✗ Incorrect
The src/test/java directory is the standard location for Java test source files in Maven projects.