Showing posts with label Maven repo jars in eclipse. Show all posts
Showing posts with label Maven repo jars in eclipse. Show all posts

Thursday, November 12, 2015

Steps to setup Java and Maven environment in Bash profile

Follow below steps
1) Start the Terminal app.
2) Open bash profile - 
$ vi ~/.bash_profile
2) Press key 'i' from keyboard to Insert text in bash profile
3) Insert Java and maven environments -
export M2_HOME=/usr/local/apache-maven/apache-maven-3.3.3
export M2=$M2_HOME/bin
export PATH=$M2:$PATH
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home
export PATH=$JAVA_HOME:$PATH

4) Press key 'Esc' 
4) Press key ':wq!' to save and quit bash profile
5) Now run source command to refresh
source ~/.bash_profile
6) Verify Java and Maven works fine
Run command - echo $JAVA_HOME
The response should be something like- /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home
Run command - mvn --version
The response should be something like-
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T04:57:37-07:00)
Maven home: /usr/local/apache-maven/apache-maven-3.3.3
Java version: 1.8.0_60, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.11.1", arch: "x86_64", family: "mac"

7) Lastly, run maven project by cd into the Java project directory (enter your project path)- 
cd /Users/[User]/Documents/workspace/Hybrid_TestNG

and run command mvn test
This should run the project successfully. 

Remember, each time you start new session, you will have to source bash profile by running below command - 

source ~/.bash_profile

---------------------------------------------------------------------------------

Friday, October 9, 2015

How to have all jars from Maven into Eclipse?

How to have include jars from Maven into Eclipse?


Assuming Project has been imported to eclipse
(If not sure, view previous post at http://selenium2testing.blogspot.com/2015/10/what-is-maven-and-how-to-setup-maven-in.html and
http://selenium2testing.blogspot.com/2015/10/create-mvn-project.html)

Find .M2 repository path (If not sure, View previous post at http://selenium2testing.blogspot.com/)
Copy the .M2 repository path. Ex - /Users/[user]/.m2/repository

Open Eclipse
Import this project
Click on Properties
Click on 'Java Build Path'
Click on Libraries Tab
Click on 'Add Variable' button
Click 'Configure Variables' button
Click New button
Give Name ' M2_REPO' . //Make sure its in caps
Give Repo Path - /Users/[user]/.m2/repository



Run command - mvn eclipse:eclipse is encountering issues with downloading of dependencies