How "/file name" works in maven project and where do I keep my downloaded jar files?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

How "/file name" works in maven project and where do I keep my downloaded jar files?

Adrien007
I wanted to convert my current project to maven.
I downloaded maven installed the plugin, right click on current project and converted it to maven.Now it's all messed up so I went to seleniumtests.com and started watching 6th selenium video about mavenizing the project. I have fixed project upto some extent . I just want to know :
- How "/file name" works in maven project and where do I keep my downloaded jar files(need to create a new folder "Library" and add jars via build path)?

- Don't I have to add jars via build path, just need to provide the path of library in pom.xml, but if I dont add them to build path , the scripts that I wrote gives error...
After creating "resources" under "src>>main" and putting my test data(chrome binary let say) there, I changed the path from "C:/Project/Browsers/chromedriver.exe" to "/chromedriver.exe" gives error "couldn't find D:/chromedriver.exe"
Please let me know what am I missing.
Reply | Threaded
Open this post in threaded view
|

Re: How "/file name" works in maven project and where do I keep my downloaded jar files?

softwaretestingforum
Administrator
Hi Pushpraj, good to know that maven project video helped you to certain extent.
I suppose by "downloaded jar" you are referring to project dependencies. The dependencies specified in pom file are automatically download and placed in ".m2" folder and your development IDE would automatically include it in project.
About the error you encountered on "/chromedriver.exe", could you post a snapshot of your code and corresponding error?
~ seleniumtests.com
Reply | Threaded
Open this post in threaded view
|

Re: How "/file name" works in maven project and where do I keep my downloaded jar files?

Adrien007
I understood why we need dependencies. But I dont get :
1. You have not specified(not in pom.xml) which folder would be considered as resource folder. So how maven know which folder to take as resource folder. In my case if I specify complete path(D:/workspace/myproj/src/main/resources/chromedriver.exe) of chromedriver.exe it works but if I change it "/chromedriver.exe" it doesn't. Though chromedriver.exe is available in src>>main>>resources and in src>>test>>resources
2. In that video you have converted the project from JAVA to MAVEN still you kept on using testng to run projects why you were not running tests or testng.xml with the help of maven. Its confusing what should we follow?Which one is better?
Reply | Threaded
Open this post in threaded view
|

Re: How "/file name" works in maven project and where do I keep my downloaded jar files?

softwaretestingforum
Administrator
1. About resource folder -
http://stackoverflow.com/questions/5477280/how-should-i-discover-test-resource-files-in-a-maven-managed-java-project

2. Using maven does not mean that you can not use testng to execute test, but by and large you would be using pom.xml to execute tests and pom file would have reference to testng.xml
~ seleniumtests.com
Reply | Threaded
Open this post in threaded view
|

Re: How "/file name" works in maven project and where do I keep my downloaded jar files?

Adrien007
I think you didn't set the resource directory the way it is shown in stackoverflow solution. As it is shown in video you simple converted project from JAVA to MAVEN and resources folder was ready to use. You didn't use such a complex way as it is explained in SOF solution.
I think I am not able to ask my question properly. Let me ask again, In maven project where we specify that files will be picked from resources folder and not from any other folder.
Reply | Threaded
Open this post in threaded view
|

Re: How "/file name" works in maven project and where do I keep my downloaded jar files?

softwaretestingforum
Administrator
Pushpraj Singh wrote
I think you didn't set the resource directory the way it is shown in stackoverflow solution. As it is shown in video you simple converted project from JAVA to MAVEN and resources folder was ready to use. You didn't use such a complex way as it is explained in SOF solution.
If you thought there is only one way of creating maven project then you would be disappointed to know that answer is No. In tutorial I used archetype to generate maven project which is one simple way to create maven project. I explained usage of resource at 31:00 in video.

Pushpraj Singh wrote
I think I am not able to ask my question properly. Let me ask again, In maven project where we specify that files will be picked from resources folder and not from any other folder.
No where. Maven is intelligent enough to know its own conventions.
~ seleniumtests.com
Reply | Threaded
Open this post in threaded view
|

Re: How "/file name" works in maven project and where do I keep my downloaded jar files?

Adrien007
SO if I create archetype project , I don't have to provide entire path of the file .
like this :
System.setProperty("webdriver.chrome.driver", "C:/workspace/mavenproj/src/test/resources/chromedriver.exe");
but
System.setProperty("webdriver.chrome.driver","/chromedriver.exe"); will work automatically, if I have copied "chromedriver.exe" in "src/test/resources" folder.
??
Reply | Threaded
Open this post in threaded view
|

Re: How "/file name" works in maven project and where do I keep my downloaded jar files?

softwaretestingforum
Administrator
Did you try it? Did you encounter any error?
~ seleniumtests.com