-1

I have a maven java project ABC which has main and test folders. The test folder has lot of API utility classes to make some API calls. These classes use some classes in the main folder.

I have another maven java project XYZ which needs to use the API utility classes in test folder of ABC. I am not sure how to use ABC code in XYZ.

I could copy-paste only the relevant code from ABC to XYZ, modifying the directory names, packages etc as needed. Or I could package ABC as Jar and import it into XYZ.

Any suggestions on how to do this ?

MasterJoe
  • 2,103
  • 5
  • 32
  • 58
  • You should move "shared" classes to separate Maven project, create jar file and use jar file in both `ABC` and `XYZ` projects. By "use jar file" I of course mean to *depend* on the new shared project. – Andreas Jul 03 '18 at 18:27

1 Answers1

0

You could build the ABC package jar into your local maven repository and then add it into XYZ's pom file as a dependency. Thus always having an up to date ABC build already imported.

An answer for adding local jars exists Here

Benehiko
  • 462
  • 3
  • 6