# Maven

## 📚 Maven in Selenium

Maven is a build automation tool used in Selenium projects.

### 🏗 Build Tool

* Maven can build, package and deploy Selenium Java projects.
* Automates builds via a pom.xml configuration file.
* Handles dependency management.

### 🛠 Project Structure

* Has a standard project structure.
* src/main/java - Application source code
* src/test/java - Test code
* target - Compiled output and deliverables

### 👍 Benefits

* 📦 Dependency management
* 🔀 Build automation
* 🚀 Continuous Integration friendly
* 📈 Scalable builds

### 📃 Maven Example for CNBC

```java
<!-- CNBC pom.xml -->

<dependencies>
  <!-- Selenium WebDriver -->
  <dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>4.1.1</version>
  </dependency>

  <!-- TestNG Testing Framework -->
  <dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>7.4.0</version>
  </dependency>

</dependencies>

<build>
  <plugins>
    <!-- Compiler Plugin -->
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
      <version>3.8.1</version>
    </plugin>
    
    <!-- Surefire Plugin -->
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <version>2.22.2</version>
    </plugin>
  </plugins>
</build>
```

This demonstrates using Maven for a Selenium project for CNBC - managing dependencies and build configuration.

<table data-view="cards"><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td></td><td></td><td>hi</td></tr><tr><td>hi</td><td></td><td></td></tr><tr><td></td><td></td><td>hi</td></tr><tr><td></td><td>hi</td><td></td></tr><tr><td></td><td>j</td><td>k</td></tr><tr><td>k</td><td>k</td><td>k</td></tr><tr><td>k</td><td>k</td><td>k</td></tr><tr><td>k</td><td>k</td><td>k</td></tr><tr><td>k</td><td></td><td>n</td></tr><tr><td>n</td><td>n</td><td>n</td></tr><tr><td>n</td><td>n</td><td>n</td></tr><tr><td>n</td><td>n</td><td></td></tr></tbody></table>
