Maven build creation
1-Download the maven and unzip
2-
Maven life cycle:
1-MAVEN COMPILE - java classes,code will be compile (maven compiler plugin )-TO COMPILE
2-MAVEN TEST-test cases, unit,regression,functional(maven surefile plugin)-TO TEST
3-MAVEN RESOURCE--jar-->JAR's/WAR's/EAR's--Resources(maven Resource plugin)- TO CREATE RESOURCE JAR'S AND WAR'S
web application we create war files(will give to QA team and they will test it)
Maven dependecy - pom.xml
Commands:
1)mvn clean install---> it will execute all complete life cycle
maven compile , maven test and maven resource
2)MVN test :----> execute only test cases
3) MVN package -DskipTests :---> SKIP the test cases and create Only build.
OR
4)mvn package -Dmaven.test.skip=true
Steps for selenium maven build creation
<?xml version="1.0" encoding="UTF-8"?>
<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>mavenLearning</groupId>
<artifactId>mavenLearning</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>mavenLearning</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<!-- below,SKIP the TEST cases and create a Build -->
<maven.test.skip>false</maven.test.skip>
</properties>
<build>
<plugins>
<!-- compile the code/tests -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<!-- execute the code/tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/main/resource/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
<!-- create the JAR built -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
<scope>compile</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
</dependencies>
</project>
Comments
Post a Comment