-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 ?

1
  • 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. Commented Jul 3, 2018 at 18:27

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.