Run Project in Maven
Sometimes we face error while compiling up the project in Maven (refer below Screenshot)

To enforce JDK Version in build path we have add plugin as follows in POM.XML
Sample Pom.xml
<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>Neeraj</groupId>
<artifactId>MyKeywordFWMavenProject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>MyKeywordFWMavenProject</name>
<url>http://maven.apache.org</url>
<build>
<pluginManagement>
<plugins>
<!-- See http://maven.apache.org/plugins/maven-clean-plugin -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<filesets>
<fileset>
<directory>src</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<!-- See http://maven.apache.org/plugins/maven-compiler-plugin -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<debug>true</debug>
<encoding>utf-8</encoding>
<optimize>true</optimize>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>javax.mail-api</artifactId>
<version>1.5.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.45.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.45.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.4</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.12</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.7</version>
</dependency>
</dependencies>
</project>
Go to command Prompt , Reach the location of your project and type
C:\Users\lakshay\workspace\MyKeywordFWMavenProject>mvn clean install
Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook
Picked up _JAVA_OPTIONS: -Xrunjvmhook -Xbootclasspath/a:"C:\Program Files (x86)\HP\Unified Functional Tes
in\java_shared\classes\jasmine.jar"
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MyKeywordFWMavenProject 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ MyKeywordFWMavenProject ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\lakshay\workspace\MyKeywordFWMavenProject\src\main\re
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ MyKeywordFWMavenProject ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ MyKeywordFWMavenProject ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\lakshay\workspace\MyKeywordFWMavenProject\src\test\re
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ MyKeywordFWMavenProject ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ MyKeywordFWMavenProject ---
[INFO] Surefire report directory: C:\Users\lakshay\workspace\MyKeywordFWMavenProject\target\surefire-repo
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running TestSuite
You Gotta xls
List size is 1
Blank Row numbers are----> 9
List size is 2
Blank Row numbers are----> 9
Blank Row numbers are----> 18
List size is 3
Blank Row numbers are----> 9
Blank Row numbers are----> 18
Blank Row numbers are----> 25
List size is 4
Blank Row numbers are----> 9
Blank Row numbers are----> 18
Blank Row numbers are----> 25
Blank Row numbers are----> 32
List size is 5
Blank Row numbers are----> 9
Blank Row numbers are----> 18
Blank Row numbers are----> 25
Blank Row numbers are----> 32
Blank Row numbers are----> 39
List size is 6
Blank Row numbers are----> 9
Blank Row numbers are----> 18
Blank Row numbers are----> 25
Blank Row numbers are----> 32
Blank Row numbers are----> 39
Blank Row numbers are----> 46
To Check if the Project is getting proper run and Jenkins is download Dependency
Go to following locations where Jenkins keep the code when build is compiled by Jenkins
C:\Program Files (x86)\Jenkins\jobs\hello\workspace

To enforce JDK Version in build path we have add plugin as follows in POM.XML
Sample Pom.xml
<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>Neeraj</groupId>
<artifactId>MyKeywordFWMavenProject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>MyKeywordFWMavenProject</name>
<url>http://maven.apache.org</url>
<build>
<pluginManagement>
<plugins>
<!-- See http://maven.apache.org/plugins/maven-clean-plugin -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<filesets>
<fileset>
<directory>src</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<!-- See http://maven.apache.org/plugins/maven-compiler-plugin -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<debug>true</debug>
<encoding>utf-8</encoding>
<optimize>true</optimize>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>javax.mail-api</artifactId>
<version>1.5.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.45.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.45.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.4</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.12</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.7</version>
</dependency>
</dependencies>
</project>
Go to command Prompt , Reach the location of your project and type
C:\Users\lakshay\workspace\MyKeywordFWMavenProject>mvn clean install
Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook
Picked up _JAVA_OPTIONS: -Xrunjvmhook -Xbootclasspath/a:"C:\Program Files (x86)\HP\Unified Functional Tes
in\java_shared\classes\jasmine.jar"
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MyKeywordFWMavenProject 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ MyKeywordFWMavenProject ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\lakshay\workspace\MyKeywordFWMavenProject\src\main\re
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ MyKeywordFWMavenProject ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ MyKeywordFWMavenProject ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\lakshay\workspace\MyKeywordFWMavenProject\src\test\re
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ MyKeywordFWMavenProject ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ MyKeywordFWMavenProject ---
[INFO] Surefire report directory: C:\Users\lakshay\workspace\MyKeywordFWMavenProject\target\surefire-repo
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running TestSuite
You Gotta xls
List size is 1
Blank Row numbers are----> 9
List size is 2
Blank Row numbers are----> 9
Blank Row numbers are----> 18
List size is 3
Blank Row numbers are----> 9
Blank Row numbers are----> 18
Blank Row numbers are----> 25
List size is 4
Blank Row numbers are----> 9
Blank Row numbers are----> 18
Blank Row numbers are----> 25
Blank Row numbers are----> 32
List size is 5
Blank Row numbers are----> 9
Blank Row numbers are----> 18
Blank Row numbers are----> 25
Blank Row numbers are----> 32
Blank Row numbers are----> 39
List size is 6
Blank Row numbers are----> 9
Blank Row numbers are----> 18
Blank Row numbers are----> 25
Blank Row numbers are----> 32
Blank Row numbers are----> 39
Blank Row numbers are----> 46
To Check if the Project is getting proper run and Jenkins is download Dependency
Go to following locations where Jenkins keep the code when build is compiled by Jenkins
C:\Program Files (x86)\Jenkins\jobs\hello\workspace
No comments:
Post a Comment