0

I have around 10 Selenium/Java projects in Eclipse IDE and there is "utils" package and Automation framework classes that i manually copied to all projects and all those have different versions or code in it.

So, like 'ExcelReader.java" utility class in my Automation framework has 10 different copies, each one in separate Project folder/structure. Now, all my code is hosted in Azure DevOps Git repos and i use eGit eclipse plugin to commit/push changes.

How can i keep just one copy of "Utils" package in Git repos and all individual projects just use that one central copy directly into it and if one tester updates central copy then all projects can "fetch' lastest code automatically.

AutomationProject1 -> Utils package/customized classes [All projects have different copies of same class]
AutomationProject2 -> Utils package/customized classes
AutomationProject3 -> Utils package/customized classes
AutomationProject4 -> Utils package/customized classes
AutomationProject5 -> Utils package/customized classes

2 Answers 2

0

You are looking to create a library. Since you mentioned Maven, this guideline can be useful: https://dzone.com/articles/how-to-create-a-java-library-from-scratch-to-maven

After you push the library to an Artifactory, you will be able to add it as dependency on the various projects and import its classes.

0

I create a .jar file of the utils package. Then I add that .jar file to the build path of each individual project. If you make changes to the code of utils classes, I would need to rebuild the .jar again with maven. After that, you then add that dependency to projects again. You can't add the .jar to artifactory.

1
  • Please register the account you posted the question with. You seem to have posted with 2 different accounts. Commented Feb 19 at 16:00

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