QA Interview: Top 30: Maven Interview Questions for QA (16:30)

 Other Useful Links:


16. What is a Maven Artifact?
  • A Maven Artifact is a file, most commonly a JAR, that is delivered to a Maven repository. The utility generates a built JAR and a source JAR, among other things.
  • Every artefact has a version string, an artefact ID, and a groupID.These three together identify the artifact.
  • Example: com.your.package,

17. What is a Maven Archetype?
  • Maven Archetype is a Maven plugin that allows you to build a project structure based on a template.
  • These archetypes are just project templates that Maven creates whenever a new project is established.

18. What command should you use to start a new project based on an archetype?

  • To build a new project based on an archetype, use the command: mvn archetype: generate.
  • After navigating to the directory where the project is located, type the command in the command prompt.
19. What does ‘Maven Clean’ imply?
  • Maven clean is a plugin that attempts to clean the files and folders created by Maven during the build process, as the name suggests.
  • The plugin deletes the target folder, which includes all of the class files, documentation, and JAR files.

20. What is a 'Dependency Scope,' and what are the different types of Dependency Scopes?
  • Dependency scope refers to all dependencies related to the current build stage.
  • The different types of dependency scopes are:
    • Compile
    • Provided
    • Runtime
    • Test
    • System
    • Import

21. What is a ‘Snapshot’ in Maven?
  • The Maven remote repository version is referred to as a snapshot. It signals the latest development copy.
  • Every new build, Maven looks for a new version of Snapshot in the remote repository.
  • The data service team updates the snapshot with new source code for each Maven build and saves it to the repository.

22. What is a Build Profile?
  • The set of configuration parameters required to build a project using various configurations is referred to as a build profile.
  • While enabling alternative builds, different build profiles are added to the POM files.
  • A build profile aids in the customization of a build for various contexts.

23. What are the various Build Profile types?
Build profiles are divided into three categories:
  • Per Project - defined in pom.xml
  • Per-User - defined in Maven settings.xml
  • Global - defined in Maven global settings.xml

24. What command should I use to install JAR files in the Local Repository?
  • mvn install
  • The following plugin is used to manually install the JAR into the local Maven repository: install-file-Dfile= mvn install

25. How do you determine which Maven version you're using?
  • The command mvn –version is used to determine which version of Maven is installed on the system.

26. What command do you use to create a Maven site?
  • - mvn site
  • The resulting site, by default, is target/site/…

27. How to perform force update in Maven?
  • mvn clean install -U

28. What does the term 'Build Tool' mean?
  • A build tool is necessary for the build process.. It is needed for the following procedures:
    • Generating source code.
    • Generating documentation from the source code.
    • Compiling of source code.
    • JAR files are created by packaging compiled code.
    • Installing bundled code into a local, server, or central repository.

29. How are ANT and Maven different?

ANT

MAVEN


Because ANT does not have any formal conventions, information must be provided in the build.xml file.

Because of Maven's conventions, information should not be included in the pom.xml file.

ANT is procedural.

Maven is declarative.

ANT has no life cycle.

Maven has a life cycle.

ANT scripts are not reusable.

Maven plugins are reusable.

ANT is specifically a build tool.

Maven is mainly used as a project management tool.


30. Sample POM.xml format

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.javatpoint.application1</groupId> <artifactId>my-application1</artifactId> <version>1.0</version> <packaging>jar</packaging> <name>Maven Quick Start Archetype</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.8.2</version> <scope>test</scope> </dependency> </dependencies> </project>


Greetings, reader! Your input is highly important to us. Please share your thoughts in the comments section below.


Contact:

Email:  piyushagrawal.automation@gmail.com

Follow on LinkedIn: Piyush Agrawal - LinkedIn

Follow on YouTube: Piyush Agrawal - Youtube

Happy to Help You !!

No comments:

Post a Comment