0

I want to include one .jar file which has classes of my core automation framework. I created a "lib" folder in my selenium project and then gave its path in the pom.xml dependency. This Jar file of framework is not a runnable jar. I exported the framework project as a jar and want to use its classes in my project.

However, im not able to use any class/method from that jar(framework) in my test scripts. Am i doing something wrong.

enter image description here

enter image description here

1 Answer 1

0

This is a very crucial part of automation, especially for parent-child project structure in POM-based automation. I also faced a similar issue when I worked on a project related to data quality testing. We have created a core framework that contains all the actions, drivers, utilities, etc. The purpose was to use this core framework in the automation of multiple projects. When I tried to use this core framework in the automation of the core project, I used the below steps to resolve that.

Let's consider, your Parent project's POM looks like this:

<groupId>com.abc</groupId>
<artifactId>xyz</artifactId>
<version>0.0.1-SNAPSHOT</version>

Run mvn clean install in the command prompt on the parent project directory. This will create a jar file of your parent project and place it in the .m2 repository of your user's folder in C drive.

Next Step, open the child's project POM file and add the above jar file as a dependency in it as mentioned below:

<dependency>
   <groupId>com.abc</groupId>
   <artifactId>xyz</artifactId>
   <version>0.0.1-SNAPSHOT</version>
</dependency>

Now, you will be able to use all the classes of the parent project in the child project. Hope this information is helpful for you. Thanks!!!!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.