Maven
With Maven, you can automatically build projects, dependencies, and documentation. Learn how to set up Maven with Perfecto. A sample project is available here: https://github.com/PerfectoMobileSA/PerfectoJavaSample
On this page:
1 | Get started
In this step, you install Java and Maven.
-
Download and install JDK 8.
-
Set up the JAVA_HOME environment variable to point to the JDK 8 installation folder.
-
Download one of the following Maven archives from
https://maven.apache.org/download.cgi:
-
Windows: The binary zip file
-
Mac: The source tar.gz file
-
-
Specify the path to Maven as follows:
Windows
Mac
a. Set up the
MAVEN_HOME
environment variable to point to the JDK 8 installation folder.b. Add
%MAVEN_HOME%\bin
to thePATH
environment variable.Update your .bash_profile
(create this file if it does not exist) with the following:export M2_HOME=/Users/<UserName>/<path to maven>
export PATH=$PATH:$M2_HOME/bin
-
Launch a command line window and run the following command to verify that the installation was successful:
Copymvn –version
2 | Create and configure a Maven project
In this step, you create a Maven project and add the repositories, dependencies, and plugins required to run it with Perfecto.
- In your IDE, create a Maven project.
-
Open the
pom.xml
file and update it as follows. A samplepom.xml
file that includes all Perfecto and Smart Reporting dependencies is available here.-
Add the following repositories.
Copy<repositories>
<repository>
<id>repo1.perfectomobile.com</id>
<name>Perfecto mobile</name>
<url>https://repo1.perfectomobile.com/public/repositories/maven</url>
</repository>
<repository>
<id>central</id>
<name>Repo1</name>
<url>http://repo1.maven.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Repo1</name>
<url>http://repo1.maven.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</pluginRepository>
</pluginRepositories> -
Add the following dependencies.
Copy<dependency>
<groupId>com.perfecto.reporting-sdk</groupId>
<artifactId>reportium-java</artifactId>
<version>RELEASE</version>
</dependency>
<dependency>
<groupId>com.perfecto.reporting-sdk</groupId>
<artifactId>reportium-testng</artifactId>
<version>RELEASE</version>
</dependency>
<dependency>
<groupId>com.perfectomobile</groupId>
<artifactId>pm-webdriver</artifactId>
<version>RELEASE</version>
</dependency>
<dependency>
<groupId>com.perfectomobile</groupId>
<artifactId>http-client</artifactId>
<version>RELEASE</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<version>1.1.6</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.5</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.1.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.16</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-api</artifactId>
<version>3.14.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-support</artifactId>
<version>3.14.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>[2.9.10,)</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>[2.9.10,)</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>[2.9.10,)</version>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>3.4.1</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>23.0</version>
</dependency>
-
-
Add the following plugin to your list of plugins:
Copy<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin> - To confirm that the dependencies have downloaded properly, execute the Maven goals -
clean install
.