Bird
0
0

Which command is used to build a Spring Boot application into an executable JAR file using Maven?

easy📝 Conceptual Q2 of 15
Spring Boot - Fundamentals
Which command is used to build a Spring Boot application into an executable JAR file using Maven?
Amvn install test
Bmvn spring-boot:run
Cjava -jar app.jar
Dmvn clean package
Step-by-Step Solution
Solution:
  1. Step 1: Identify Maven build commands

    To create a JAR file, 'mvn clean package' compiles and packages the app.
  2. Step 2: Differentiate run and build commands

    'mvn spring-boot:run' runs without building a JAR, 'java -jar' runs the JAR, 'mvn install test' is incorrect.
  3. Final Answer:

    mvn clean package -> Option D
  4. Quick Check:

    Build JAR = mvn clean package [OK]
Quick Trick: Use 'mvn clean package' to build executable JAR [OK]
Common Mistakes:
  • Confusing run with build commands
  • Trying to run without building
  • Using wrong Maven goals

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes