13
by Amelia Ilies, Kati Holasz

Maven Setup

Embed Size (px)

Citation preview

Page 1: Maven Setup

by Amelia Ilies,

Kati Holasz

Page 2: Maven Setup

Setup

Maven is Java based tool, so the very first requirement is to have JDK installed in your machine.

Download and install Java JDK::

http://www.oracle.com/technetwork/java/javase/downloads/jdk6downloads-1902814.html

Download and install Apache Maven:http://maven.apache.org/download.cgi

Download and install Eclipse JDK:http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/junosr2

Download and install Mozilla Firefox:http://www.mozilla.org/

Page 3: Maven Setup

Steps

Step 1Step 1 - verify Java installation in your machine - verify Java installation in your machine c:\>java -version c:\>java -version

Step 2Step 2 - set JAVA environment: - set JAVA environment: JAVA_HOME to C:\Program Files\Java\JAVA_HOME to C:\Program Files\Java\

jdk1.6.0_21jdk1.6.0_21

Step 3Step 3 - download Maven archive: - download Maven archive: http://maven.apache.org/download.html http://maven.apache.org/download.html

Step 4Step 4 - extract the Maven archive: - extract the Maven archive: C:\Program Files\Apache Software C:\Program Files\Apache Software

Foundation\apache-mavenFoundation\apache-maven

Page 4: Maven Setup

4

Setup environment variablesSetup environment variables

Start → Control Panel → System and Security → System → Advanced system settings → Environment Variables

Step 5 Step 5 - set Maven environment variables:- set Maven environment variables:

Step 6Step 6 – set Path for Maven and Java – set Path for Maven and Java

Step 7Step 7 - verify Maven installation: - verify Maven installation:

c:\> mvn --versionc:\> mvn --version

Page 5: Maven Setup

Creating a Java project using

Execute the following mvn command:

C:\MVN>mvn archetype:generate →DgroupId=com

→DartifactId=application →DarchetypeArtifactId=maven-archetype-quickstart →DinteractiveMode=false

Page 6: Maven Setup

Creating a Java project using

Page 7: Maven Setup

Creating a Java project using

Page 8: Maven Setup

.

Import Maven Project

Page 9: Maven Setup

After Import – into Eclipse IDe

Page 10: Maven Setup

SureFire and FailSafe configuration – Pom.xml

SureFireSureFire FailSafeFailSafe

Page 11: Maven Setup

Running tests in parallel

Using JUnit

Page 12: Maven Setup

Running test

Run tests with:

mvn surefire:test

Run test with FailSafe

mvn failsafe:test-integration

mvn failsafe:verify

Run a single test

mvn -Dtest=Login test

Run a set of methods in a single test

mvn -Dtest=LoginTest#Log_In test

Generate reports and site

mvn site

Skip tests with SureFire

- go to pom.xml and add: <skip>true</skip> to configuration tag specific to SureFire

Page 13: Maven Setup

Good Luck!